/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cuadroanotacion.start;

import com.sun.org.apache.bcel.internal.generic.AALOAD;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
import org.cuadroanotacionapi.beans.Jos_fastball_gamestatus;
import org.cuadroanotacionapi.beans.Jos_fastball_gametype;
import org.cuadroanotacionapi.beans.Jos_fastball_linescore;
import org.cuadroanotacionapi.beans.Jos_fastball_location;
import org.cuadroanotacionapi.beans.Jos_fastball_player;
import org.cuadroanotacionapi.beans.Jos_fastball_playerstat;
import org.cuadroanotacionapi.beans.Jos_fastball_schedule;
import org.cuadroanotacionapi.beans.Jos_fastball_season;
import org.cuadroanotacionapi.beans.Jos_fastball_team;
import org.cuadroanotacionapi.controller.*;
import org.cuadroanotacionapi.generales.Mensajeria;

/**
 *
 * @author avbravo
 */
public class AnotacionesCambiarFrame extends javax.swing.JInternalFrame {

    Jos_fastball_schedule jos_fastball_schedule1 = new Jos_fastball_schedule();
    Jos_fastball_scheduleController jos_fastball_scheduleController1 = new Jos_fastball_scheduleController();
    Jos_fastball_team jos_fastball_team1 = new Jos_fastball_team();
    Jos_fastball_teamController jos_fastball_teamController1 = new Jos_fastball_teamController();
    Jos_fastball_gametype jos_fastball_gametype1 = new Jos_fastball_gametype();
    Jos_fastball_gametypeController jos_fastball_gametypeController1 = new Jos_fastball_gametypeController();
    Jos_fastball_location jos_fastball_location1 = new Jos_fastball_location();
    Jos_fastball_locationController jos_fastball_locationController1 = new Jos_fastball_locationController();
    Jos_fastball_player jos_fastball_player1 = new Jos_fastball_player();
    Jos_fastball_playerController jos_fastball_playerController1 = new Jos_fastball_playerController();
    Jos_fastball_season jos_fastball_season1 = new Jos_fastball_season();
    Jos_fastball_seasonController jos_fastball_seasonContoller1 = new Jos_fastball_seasonController();
    Jos_fastball_linescore jos_fastball_linescore1 = new Jos_fastball_linescore();
    Jos_fastball_linescoreController jos_fastball_linescoreController1 = new Jos_fastball_linescoreController();
    Jos_fastball_gamestatus jos_fastball_gamestatus1 = new Jos_fastball_gamestatus();
    Jos_fastball_gamestatusController jos_fastball_gamestatusController1 = new Jos_fastball_gamestatusController();
    Jos_fastball_playerstat jos_fastball_playerstat1 = new Jos_fastball_playerstat();
    Jos_fastball_playerstatController jos_fastball_playerstatController1 = new Jos_fastball_playerstatController();
    List<Jos_fastball_team> jos_fastball_teamlist = new ArrayList<>();
    List<Jos_fastball_player> jos_fastball_playerlist = new ArrayList<>();
    DefaultTableModel modeloLocal, modeloVisitante, modeloResultado, modeloResultado2, modeloResultado3;
    DefaultTableModel modeloPitchingLocal, modeloPitchingVisitante, modeloHittingLocal, modeloHittingVisitante;
    DefaultTableModel modeloJugadores;
    int fila = -1;
    Integer idtemporada = 0;
    Integer idequipovisitante = 0;
    Integer idpartido = 0;
    String equipolocal = "";
    String equipovisitante = "";
    Integer episodio = 0;
    Integer estatus = 0;
    String controlLlamado;
    JComboBox comboINN;
    String varControl = "started";
    StringBuilder sbMensajes = new StringBuilder();
    Integer idequipolocal;
    JLabel statusLabel = new JLabel();

    /**
     * Creates new form Anotaciones
     */
    public AnotacionesCambiarFrame() {
        initComponents();
        if (SesionLocal.getIdtemporada() == -1) {
            Mensajeria.Mensaje("Debe seleccionar primero la temorada para utilizar esta opcion");
            dispose();
        }
        statusLabel.setForeground(Color.blue);
jXStatusBar1.add(statusLabel);
        comboINN = new JComboBox();
        comboINN.addItem("--");
        comboINN.addItem("1/3");
        comboINN.addItem("2/3");

        modeloLocal = (DefaultTableModel) jTableHittingLocal.getModel();
//        modeloVisitante = (DefaultTableModel) jTableVisitante.getModel();
        modeloResultado = (DefaultTableModel) jTableResultado.getModel();
        modeloResultado2 = (DefaultTableModel) jTableResultado2.getModel();
        modeloResultado3 = (DefaultTableModel) jTableResultado3.getModel();

        modeloPitchingLocal = (DefaultTableModel) jTablePitchingLocal.getModel();
        modeloPitchingVisitante = (DefaultTableModel) jTablePitchingVisitante.getModel();
        modeloHittingLocal = (DefaultTableModel) jTableHittingLocal.getModel();
        modeloHittingVisitante = (DefaultTableModel) jTableHittingVisitante.getModel();
        modeloJugadores = (DefaultTableModel) jTableJugadores.getModel();


// Instanciamos el TableRowSorter y lo añadimos al JTable
        TableRowSorter<TableModel> elQueOrdena = new TableRowSorter<TableModel>(modeloHittingLocal);
        jTableHittingLocal.setRowSorter(elQueOrdena);

        TableRowSorter<TableModel> elQueOrdena2 = new TableRowSorter<TableModel>(modeloHittingVisitante);
        jTableHittingVisitante.setRowSorter(elQueOrdena2);

        TableRowSorter<TableModel> elQueOrdena3 = new TableRowSorter<TableModel>(modeloPitchingLocal);
        jTablePitchingLocal.setRowSorter(elQueOrdena3);

        TableRowSorter<TableModel> elQueOrdena4 = new TableRowSorter<TableModel>(modeloPitchingVisitante);
        jTablePitchingVisitante.setRowSorter(elQueOrdena4);

        TableColumn columnId = jTableHittingLocal.getColumnModel().getColumn(2);
        columnId.setPreferredWidth(60);

        TableColumn columnjugador = jTableHittingLocal.getColumnModel().getColumn(3);
        columnjugador.setPreferredWidth(SesionLocal.getTamanoNombreJugador());
        for (int i = 4; i < jTableHittingLocal.getColumnCount(); i++) {
            TableColumn column = jTableHittingLocal.getColumnModel().getColumn(i);
            column.setPreferredWidth(60);
        }
        /*
         *
         */
        columnId = jTableHittingVisitante.getColumnModel().getColumn(2);
        columnId.setPreferredWidth(60);

        columnjugador = jTableHittingVisitante.getColumnModel().getColumn(3);
        columnjugador.setPreferredWidth(SesionLocal.getTamanoNombreJugador());
        for (int i = 4; i < jTableHittingVisitante.getColumnCount(); i++) {
            TableColumn column = jTableHittingVisitante.getColumnModel().getColumn(i);
            column.setPreferredWidth(60);
        }

        columnId = jTablePitchingLocal.getColumnModel().getColumn(3);
        columnId.setPreferredWidth(60);

        columnjugador = jTablePitchingLocal.getColumnModel().getColumn(3);
        columnjugador.setPreferredWidth(SesionLocal.getTamanoNombreJugador());
        for (int i = 4; i < jTablePitchingLocal.getColumnCount(); i++) {
            TableColumn column = jTablePitchingLocal.getColumnModel().getColumn(i);
            column.setPreferredWidth(60);
        }

        columnId = jTablePitchingVisitante.getColumnModel().getColumn(2);
        columnId.setPreferredWidth(60);

        columnjugador = jTablePitchingVisitante.getColumnModel().getColumn(3);
        columnjugador.setPreferredWidth(SesionLocal.getTamanoNombreJugador());
        for (int i = 4; i < jTablePitchingVisitante.getColumnCount(); i++) {
            TableColumn column = jTablePitchingVisitante.getColumnModel().getColumn(i);
            column.setPreferredWidth(60);
        }
        TableColumn column = jTablePitchingLocal.getColumnModel().getColumn(5);
        column.setPreferredWidth(60);
        column.setCellEditor(new DefaultCellEditor(comboINN));
        comboINN.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
//               ComboAction(evt);
            }
        });
        column = jTablePitchingVisitante.getColumnModel().getColumn(5);
        column.setPreferredWidth(60);
        column.setCellEditor(new DefaultCellEditor(comboINN));
        comboINN.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
//               ComboAction(evt);
            }
        });

        if (!CargarListaEquipos()) {
            //   return;
        }
        HiloIniciar();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDialogAgregar = new javax.swing.JDialog();
        jPanel3 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jTextFieldEquipoJugadores = new javax.swing.JTextField();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTableJugadores = new javax.swing.JTable();
        jButtonAgregar = new javax.swing.JButton();
        jButtonCerrar1 = new javax.swing.JButton();
        jDialogMensajesResultados = new javax.swing.JDialog();
        jLabel18 = new javax.swing.JLabel();
        jScrollPane8 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jPanel1 = new javax.swing.JPanel();
        jButton7 = new javax.swing.JButton();
        jDialogIning = new javax.swing.JDialog();
        jLabel17 = new javax.swing.JLabel();
        jTextFieldEpisodiosDialogo = new javax.swing.JTextField();
        jButton8 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jXComboBoxPartido = new org.jdesktop.swingx.JXComboBox();
        jLabel8 = new javax.swing.JLabel();
        jXComboBoxTemporada = new org.jdesktop.swingx.JXComboBox();
        jLabel15 = new javax.swing.JLabel();
        jTextFieldIdPartido = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jTextFieldEstatusOld = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        jXComboBoxEstatus = new org.jdesktop.swingx.JXComboBox();
        jButtonGuardar = new javax.swing.JButton();
        jButtonCerrar = new javax.swing.JButton();
        jButtonCargar = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        jTextFieldEpisodios = new javax.swing.JTextField();
        jButtonEstablecerEpisodios = new javax.swing.JButton();
        jXStatusBar1 = new org.jdesktop.swingx.JXStatusBar();
        jPanel9 = new javax.swing.JPanel();
        jLabelFotoLocal1 = new javax.swing.JLabel();
        jLabelFotoVisitante1 = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanelResultado = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jTextFieldLocal = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jTextFieldVisitante = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jTextFieldTipo = new javax.swing.JTextField();
        jTextFieldEstadio = new javax.swing.JTextField();
        jTextFieldFecha = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTableResultado = new javax.swing.JTable();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTableResultado2 = new javax.swing.JTable();
        jScrollPane6 = new javax.swing.JScrollPane();
        jTableResultado3 = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTableHittingLocal = new javax.swing.JTable();
        jLabel11 = new javax.swing.JLabel();
        jTextFieldNombreEquipoLocal1 = new javax.swing.JTextField();
        jToolBar2 = new javax.swing.JToolBar();
        jButtonEliminar = new javax.swing.JButton();
        jButtonAgregarJugadores = new javax.swing.JButton();
        jButtonSeleccionarTodo = new javax.swing.JButton();
        jButton = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        jTablePitchingLocal = new javax.swing.JTable();
        jTextFieldNombreEquipoLocal2 = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jToolBar1 = new javax.swing.JToolBar();
        jButtonEliminar2 = new javax.swing.JButton();
        jButtonAgregarJugadorPittchingLocal = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTableHittingVisitante = new javax.swing.JTable();
        jTextFieldNombreEquipoVisitante1 = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jToolBar3 = new javax.swing.JToolBar();
        jButtonEliminar3 = new javax.swing.JButton();
        jButtonAgregarJugadoresHittingVisitante = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane9 = new javax.swing.JScrollPane();
        jTablePitchingVisitante = new javax.swing.JTable();
        jButtonEliminar4 = new javax.swing.JButton();
        jTextFieldNombreEquipoVisitante2 = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jToolBar4 = new javax.swing.JToolBar();
        jButtonAgregarPittchingVisitante = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();

        jDialogAgregar.setAlwaysOnTop(true);

        jLabel10.setText("Equipo");

        jTextFieldEquipoJugadores.setEditable(false);
        jTextFieldEquipoJugadores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldEquipoJugadoresActionPerformed(evt);
            }
        });

        jTableJugadores.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null}
            },
            new String [] {
                "", "pos", "id", "#", "Jugador"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Boolean.class, java.lang.Integer.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane3.setViewportView(jTableJugadores);
        jTableJugadores.getColumnModel().getColumn(0).setPreferredWidth(20);
        jTableJugadores.getColumnModel().getColumn(1).setPreferredWidth(60);
        jTableJugadores.getColumnModel().getColumn(2).setPreferredWidth(60);
        jTableJugadores.getColumnModel().getColumn(3).setPreferredWidth(60);
        jTableJugadores.getColumnModel().getColumn(4).setPreferredWidth(300);

        jButtonAgregar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/add.png"))); // NOI18N
        jButtonAgregar.setText("Agregar");
        jButtonAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAgregarActionPerformed(evt);
            }
        });

        jButtonCerrar1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/return.png"))); // NOI18N
        jButtonCerrar1.setText("Cerrar");
        jButtonCerrar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCerrar1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel10)
                                .addGap(18, 18, 18)
                                .addComponent(jTextFieldEquipoJugadores, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 452, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(50, 50, 50)
                        .addComponent(jButtonAgregar)
                        .addGap(52, 52, 52)
                        .addComponent(jButtonCerrar1)))
                .addContainerGap(67, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jTextFieldEquipoJugadores, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 369, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButtonAgregar, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE)
                    .addComponent(jButtonCerrar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout jDialogAgregarLayout = new javax.swing.GroupLayout(jDialogAgregar.getContentPane());
        jDialogAgregar.getContentPane().setLayout(jDialogAgregarLayout);
        jDialogAgregarLayout.setHorizontalGroup(
            jDialogAgregarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jDialogAgregarLayout.setVerticalGroup(
            jDialogAgregarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDialogAgregarLayout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        jDialogMensajesResultados.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                jDialogMensajesResultadosWindowClosed(evt);
            }
            public void windowClosing(java.awt.event.WindowEvent evt) {
                jDialogMensajesResultadosWindowClosing(evt);
            }
        });

        jLabel18.setText("INFORMES DEL PROCESO");

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane8.setViewportView(jTextArea1);

        jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/return.png"))); // NOI18N
        jButton7.setText("Cerrar");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(26, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jDialogMensajesResultadosLayout = new javax.swing.GroupLayout(jDialogMensajesResultados.getContentPane());
        jDialogMensajesResultados.getContentPane().setLayout(jDialogMensajesResultadosLayout);
        jDialogMensajesResultadosLayout.setHorizontalGroup(
            jDialogMensajesResultadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDialogMensajesResultadosLayout.createSequentialGroup()
                .addGroup(jDialogMensajesResultadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jDialogMensajesResultadosLayout.createSequentialGroup()
                        .addGap(160, 160, 160)
                        .addComponent(jLabel18))
                    .addGroup(jDialogMensajesResultadosLayout.createSequentialGroup()
                        .addGap(23, 23, 23)
                        .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 563, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jDialogMensajesResultadosLayout.createSequentialGroup()
                        .addGap(193, 193, 193)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(22, Short.MAX_VALUE))
        );
        jDialogMensajesResultadosLayout.setVerticalGroup(
            jDialogMensajesResultadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDialogMensajesResultadosLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel18)
                .addGap(42, 42, 42)
                .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(27, Short.MAX_VALUE))
        );

        jDialogIning.setTitle("Ining Jugados");

        jLabel17.setText("Episodios Jugados");

        jTextFieldEpisodiosDialogo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldEpisodiosDialogoActionPerformed(evt);
            }
        });

        jButton8.setText("Aceptar");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jDialogIningLayout = new javax.swing.GroupLayout(jDialogIning.getContentPane());
        jDialogIning.getContentPane().setLayout(jDialogIningLayout);
        jDialogIningLayout.setHorizontalGroup(
            jDialogIningLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDialogIningLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel17)
                .addGap(18, 18, 18)
                .addComponent(jTextFieldEpisodiosDialogo, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(29, 29, 29)
                .addComponent(jButton8)
                .addContainerGap(108, Short.MAX_VALUE))
        );
        jDialogIningLayout.setVerticalGroup(
            jDialogIningLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDialogIningLayout.createSequentialGroup()
                .addGap(86, 86, 86)
                .addGroup(jDialogIningLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(jTextFieldEpisodiosDialogo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton8))
                .addContainerGap(102, Short.MAX_VALUE))
        );

        setTitle("Anotaciones");

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Partido"));
        jPanel2.setEnabled(false);

        jLabel1.setText("Partido");

        jXComboBoxPartido.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXComboBoxPartidoActionPerformed(evt);
            }
        });

        jLabel8.setText("Temporada");

        jXComboBoxTemporada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXComboBoxTemporadaActionPerformed(evt);
            }
        });

        jLabel15.setText("Idpartido");

        jTextFieldIdPartido.setEditable(false);

        jLabel16.setText("Estado");

        jTextFieldEstatusOld.setEditable(false);

        jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel9.setText("Nuevo Estatus");

        jXComboBoxEstatus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jXComboBoxEstatusActionPerformed(evt);
            }
        });

        jButtonGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/save.gif"))); // NOI18N
        jButtonGuardar.setText("Modificar");
        jButtonGuardar.setEnabled(false);
        jButtonGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonGuardarActionPerformed(evt);
            }
        });

        jButtonCerrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/return.png"))); // NOI18N
        jButtonCerrar.setText("Cerrar");
        jButtonCerrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCerrarActionPerformed(evt);
            }
        });

        jButtonCargar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/search.gif"))); // NOI18N
        jButtonCargar.setText("Consultar");
        jButtonCargar.setEnabled(false);
        jButtonCargar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCargarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addContainerGap(47, Short.MAX_VALUE)
                        .addComponent(jLabel9))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(38, 38, 38)
                        .addComponent(jButtonCargar)))
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(44, 44, 44)
                        .addComponent(jButtonGuardar)
                        .addGap(34, 34, 34)
                        .addComponent(jButtonCerrar))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jXComboBoxEstatus, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(63, 63, 63))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addContainerGap(23, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jXComboBoxEstatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButtonCargar, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButtonGuardar, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButtonCerrar, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        jLabel7.setText("Numero de episodios");

        jTextFieldEpisodios.setEditable(false);
        jTextFieldEpisodios.setText("0");
        jTextFieldEpisodios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldEpisodiosActionPerformed(evt);
            }
        });

        jButtonEstablecerEpisodios.setText("Establecer Cantidad Episodios");
        jButtonEstablecerEpisodios.setEnabled(false);
        jButtonEstablecerEpisodios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEstablecerEpisodiosActionPerformed(evt);
            }
        });

        jLabelFotoLocal1.setText(".");

        jLabelFotoVisitante1.setText(".");

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabelFotoLocal1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                .addComponent(jLabelFotoVisitante1, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabelFotoVisitante1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jLabelFotoLocal1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jXComboBoxTemporada, javax.swing.GroupLayout.PREFERRED_SIZE, 597, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jXComboBoxPartido, javax.swing.GroupLayout.PREFERRED_SIZE, 618, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addGap(18, 18, 18)
                        .addComponent(jTextFieldEpisodios, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButtonEstablecerEpisodios))
                    .addComponent(jXStatusBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 863, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(92, 92, 92)
                        .addComponent(jTextFieldEstatusOld, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldIdPartido, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel16))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(jXComboBoxTemporada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(26, 26, 26)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(jXComboBoxPartido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jTextFieldEpisodios, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jButtonEstablecerEpisodios)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 87, Short.MAX_VALUE)
                        .addComponent(jXStatusBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(147, 147, 147)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15)
                            .addComponent(jTextFieldIdPartido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextFieldEstatusOld, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel16))
                        .addContainerGap(60, Short.MAX_VALUE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
        );

        jLabel2.setText("Local");

        jTextFieldLocal.setEditable(false);
        jTextFieldLocal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldLocalActionPerformed(evt);
            }
        });

        jLabel3.setText("Visitante");

        jTextFieldVisitante.setEditable(false);
        jTextFieldVisitante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldVisitanteActionPerformed(evt);
            }
        });

        jLabel4.setText("Fecha");

        jLabel5.setText("Estadio");

        jLabel6.setText("Tipo");

        jTextFieldTipo.setEditable(false);

        jTextFieldEstadio.setEditable(false);

        jTextFieldFecha.setEditable(false);

        jTableResultado.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Equipo", "1", "2", "3", "4", "5", "6", "7", "8", "9", "C", "H", "E"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, true, true, true, true, true, true, true, true, true, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(jTableResultado);

        jTableResultado2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Equipo", "10", "11", "12", "13", "14", "15", "16", "17", "18"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, true, true, true, true, true, true, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane5.setViewportView(jTableResultado2);

        jTableResultado3.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Equipo", "19", "20", "21", "22", "23", "24", "25", "26", "27"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, true, true, true, true, true, true, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane6.setViewportView(jTableResultado3);

        javax.swing.GroupLayout jPanelResultadoLayout = new javax.swing.GroupLayout(jPanelResultado);
        jPanelResultado.setLayout(jPanelResultadoLayout);
        jPanelResultadoLayout.setHorizontalGroup(
            jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelResultadoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelResultadoLayout.createSequentialGroup()
                        .addGroup(jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel4)
                                .addComponent(jLabel2))
                            .addComponent(jLabel5))
                        .addGap(29, 29, 29)
                        .addGroup(jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelResultadoLayout.createSequentialGroup()
                                .addGroup(jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jTextFieldLocal, javax.swing.GroupLayout.DEFAULT_SIZE, 254, Short.MAX_VALUE)
                                    .addComponent(jTextFieldFecha))
                                .addGap(204, 204, 204)
                                .addGroup(jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanelResultadoLayout.createSequentialGroup()
                                        .addComponent(jLabel3)
                                        .addGap(18, 18, 18)
                                        .addComponent(jTextFieldVisitante, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanelResultadoLayout.createSequentialGroup()
                                        .addComponent(jLabel6)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jTextFieldTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addComponent(jTextFieldEstadio, javax.swing.GroupLayout.PREFERRED_SIZE, 758, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 960, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 960, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 960, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(447, Short.MAX_VALUE))
        );
        jPanelResultadoLayout.setVerticalGroup(
            jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelResultadoLayout.createSequentialGroup()
                .addGap(17, 17, 17)
                .addGroup(jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelResultadoLayout.createSequentialGroup()
                        .addGroup(jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(jTextFieldLocal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(jTextFieldFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(jLabel5))
                    .addGroup(jPanelResultadoLayout.createSequentialGroup()
                        .addGroup(jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(jTextFieldVisitante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanelResultadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextFieldTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jTextFieldEstadio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(27, 27, 27)
                .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(76, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Resultado", jPanelResultado);

        jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane2.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        jTableHittingLocal.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "", "ord", "id", "Jugador", "PA", "1B", "2B", "3B", "HR", "RBI", "BB", "SO", "HBP", "ROE", "FC", "SAC", "DP", "R", "SB", "CS", "LOB", "Asst", "PO", "E", "IC", "PB", "SB", "CS", "CO"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Boolean.class, java.lang.Integer.class, java.lang.Object.class, java.lang.Object.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                true, true, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane2.setViewportView(jTableHittingLocal);
        jTableHittingLocal.getColumnModel().getColumn(0).setPreferredWidth(30);
        jTableHittingLocal.getColumnModel().getColumn(1).setPreferredWidth(60);

        jLabel11.setText("Equipo");

        jTextFieldNombreEquipoLocal1.setEnabled(false);

        jToolBar2.setRollover(true);

        jButtonEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/delete.gif"))); // NOI18N
        jButtonEliminar.setText("Eliminar");
        jButtonEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEliminarActionPerformed(evt);
            }
        });
        jToolBar2.add(jButtonEliminar);

        jButtonAgregarJugadores.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/new.gif"))); // NOI18N
        jButtonAgregarJugadores.setText("Agregar  Jugadores");
        jButtonAgregarJugadores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAgregarJugadoresActionPerformed(evt);
            }
        });
        jToolBar2.add(jButtonAgregarJugadores);

        jButtonSeleccionarTodo.setText("Seleccionar Todo");
        jButtonSeleccionarTodo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSeleccionarTodoActionPerformed(evt);
            }
        });
        jToolBar2.add(jButtonSeleccionarTodo);

        jButton.setText("Deseleccionar Todo");
        jButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonActionPerformed(evt);
            }
        });
        jToolBar2.add(jButton);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(jLabel11)
                        .addGap(18, 18, 18)
                        .addComponent(jTextFieldNombreEquipoLocal1, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(131, 131, 131)
                        .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, 579, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 1230, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(177, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel11)
                        .addComponent(jTextFieldNombreEquipoLocal1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 363, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(116, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Hitting-Local", jPanel4);

        jScrollPane7.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane7.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        jTablePitchingLocal.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "", "ord", "id", "Jugador", "INN", "/", "PIT", "BF", "AB", "H", "R", "ER", "BB", "K", "HR", "WP", "HB", "W", "L", "SV", "CG", "SHO"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Boolean.class, java.lang.Integer.class, java.lang.Object.class, java.lang.Object.class, java.lang.Integer.class, java.lang.Object.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Boolean.class, java.lang.Boolean.class, java.lang.Boolean.class, java.lang.Boolean.class, java.lang.Boolean.class
            };
            boolean[] canEdit = new boolean [] {
                true, true, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane7.setViewportView(jTablePitchingLocal);
        jTablePitchingLocal.getColumnModel().getColumn(0).setPreferredWidth(30);
        jTablePitchingLocal.getColumnModel().getColumn(1).setPreferredWidth(60);

        jTextFieldNombreEquipoLocal2.setEnabled(false);

        jLabel12.setText("Equipo");

        jToolBar1.setRollover(true);

        jButtonEliminar2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/delete.gif"))); // NOI18N
        jButtonEliminar2.setText("Eliminar");
        jButtonEliminar2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEliminar2ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButtonEliminar2);

        jButtonAgregarJugadorPittchingLocal.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/new.gif"))); // NOI18N
        jButtonAgregarJugadorPittchingLocal.setText("Agregar Jugador");
        jButtonAgregarJugadorPittchingLocal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAgregarJugadorPittchingLocalActionPerformed(evt);
            }
        });
        jToolBar1.add(jButtonAgregarJugadorPittchingLocal);

        jButton1.setText("Seleccionar Todo");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton1);

        jButton2.setText("Deseleccionar todo");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton2);

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 1230, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(211, 211, 211))
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(jLabel12)
                .addGap(18, 18, 18)
                .addComponent(jTextFieldNombreEquipoLocal2, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(158, 158, 158)
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 543, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel12)
                        .addComponent(jTextFieldNombreEquipoLocal2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(14, 14, 14)
                .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 363, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(120, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Pitching-Local", jPanel7);

        jScrollPane4.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane4.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        jTableHittingVisitante.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "", "ord", "id", "Jugador", "PA", "1B", "2B", "3B", "HR", "RBI", "BB", "SO", "HBP", "ROE", "FC", "SAC", "DP", "R", "SB", "CS", "LOB", "Asst", "PO", "E", "IC", "PB", "SB", "CS", "CO"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Boolean.class, java.lang.Integer.class, java.lang.Object.class, java.lang.Object.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                true, true, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane4.setViewportView(jTableHittingVisitante);
        jTableHittingVisitante.getColumnModel().getColumn(0).setPreferredWidth(30);
        jTableHittingVisitante.getColumnModel().getColumn(1).setPreferredWidth(60);

        jTextFieldNombreEquipoVisitante1.setEnabled(false);

        jLabel13.setText("Equipo");

        jToolBar3.setRollover(true);

        jButtonEliminar3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/delete.gif"))); // NOI18N
        jButtonEliminar3.setText("Eliminar");
        jButtonEliminar3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEliminar3ActionPerformed(evt);
            }
        });
        jToolBar3.add(jButtonEliminar3);

        jButtonAgregarJugadoresHittingVisitante.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/new.gif"))); // NOI18N
        jButtonAgregarJugadoresHittingVisitante.setText("Agregar Jugadores");
        jButtonAgregarJugadoresHittingVisitante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAgregarJugadoresHittingVisitanteActionPerformed(evt);
            }
        });
        jToolBar3.add(jButtonAgregarJugadoresHittingVisitante);

        jButton3.setText("Seleccionar todo");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton3);

        jButton4.setText("Deseleccionar todo");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton4);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 1230, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel13)
                        .addGap(18, 18, 18)
                        .addComponent(jTextFieldNombreEquipoVisitante1, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(137, 137, 137)
                        .addComponent(jToolBar3, javax.swing.GroupLayout.PREFERRED_SIZE, 569, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(189, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel13)
                        .addComponent(jTextFieldNombreEquipoVisitante1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jToolBar3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(9, 9, 9)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 363, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(125, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Hitting-Visitante", jPanel6);

        jScrollPane9.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane9.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        jTablePitchingVisitante.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "", "ord", "id", "Jugador", "INN", "/", "PIT", "BF", "AB", "H", "R", "ER", "BB", "K", "HR", "WP", "HB", "W", "L", "SV", "CG", "SHO"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Boolean.class, java.lang.Integer.class, java.lang.Object.class, java.lang.Object.class, java.lang.Integer.class, java.lang.Object.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Boolean.class, java.lang.Boolean.class, java.lang.Boolean.class, java.lang.Boolean.class, java.lang.Boolean.class
            };
            boolean[] canEdit = new boolean [] {
                true, true, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane9.setViewportView(jTablePitchingVisitante);
        jTablePitchingVisitante.getColumnModel().getColumn(0).setPreferredWidth(30);
        jTablePitchingVisitante.getColumnModel().getColumn(1).setPreferredWidth(60);

        jButtonEliminar4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/delete.gif"))); // NOI18N
        jButtonEliminar4.setText("Eliminar");
        jButtonEliminar4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEliminar4ActionPerformed(evt);
            }
        });

        jTextFieldNombreEquipoVisitante2.setEnabled(false);

        jLabel14.setText("Equipo");

        jToolBar4.setRollover(true);

        jButtonAgregarPittchingVisitante.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/new.gif"))); // NOI18N
        jButtonAgregarPittchingVisitante.setText("Agregar Jugador");
        jButtonAgregarPittchingVisitante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAgregarPittchingVisitanteActionPerformed(evt);
            }
        });
        jToolBar4.add(jButtonAgregarPittchingVisitante);

        jButton5.setText("Seleccionar  Todos");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });
        jToolBar4.add(jButton5);

        jButton6.setText("Deseleccionar Todos");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });
        jToolBar4.add(jButton6);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGap(98, 98, 98)
                        .addComponent(jButtonEliminar4))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 1230, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(jLabel14)
                        .addGap(18, 18, 18)
                        .addComponent(jTextFieldNombreEquipoVisitante2, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(178, 178, 178)
                        .addComponent(jToolBar4, javax.swing.GroupLayout.PREFERRED_SIZE, 504, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(177, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel14)
                        .addComponent(jTextFieldNombreEquipoVisitante2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jToolBar4, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 363, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 52, Short.MAX_VALUE)
                .addComponent(jButtonEliminar4)
                .addGap(35, 35, 35))
        );

        jTabbedPane1.addTab("Pitching-Visitante", jPanel8);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1427, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(180, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 573, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCerrarActionPerformed
        dispose();
    }//GEN-LAST:event_jButtonCerrarActionPerformed

    private void jXComboBoxPartidoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXComboBoxPartidoActionPerformed
    }//GEN-LAST:event_jXComboBoxPartidoActionPerformed

    private void jTextFieldVisitanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldVisitanteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldVisitanteActionPerformed

    private void jTextFieldLocalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldLocalActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldLocalActionPerformed

    private void jXComboBoxTemporadaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXComboBoxTemporadaActionPerformed
        try {
            int a = jXComboBoxTemporada.getSelectedIndex();
            if (a != -1) {
                jos_fastball_season1 = jos_fastball_seasonContoller1.getJos_fastball_seasonlist().get(a);
                this.idtemporada = jos_fastball_season1.getId();

                CargarAgenda();
            }

        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "ComboBoxTemporada()");
        }

    }//GEN-LAST:event_jXComboBoxTemporadaActionPerformed

    private void jButtonCargarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCargarActionPerformed
        try {
            HiloCargar();
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Boton Cargar()");
        }

    }//GEN-LAST:event_jButtonCargarActionPerformed

    private void jButtonEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEliminarActionPerformed
        try {
            int pos;
            while (true) {
                pos = PosicionMarcado(modeloHittingLocal, 0);
                if (pos != -1) {
                    modeloHittingLocal.removeRow(pos);
                } else {
                    break;
                }
            }

        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Eliminar");
        }
    }//GEN-LAST:event_jButtonEliminarActionPerformed

       private void CargarFotosLocales() {
        try {
            jLabelFotoLocal1.setText("");
            switch (idequipolocal) {
                case 30:
                    jLabelFotoLocal1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Bocas.png"))); // NOI18N
                  
                    break;
                case 31:
                    jLabelFotoLocal1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Cocle.png"))); // NOI18N
                    break;
                case 32:
                    jLabelFotoLocal1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Colon.png"))); // NOI18N
                    break;
                case 33:
                    jLabelFotoLocal1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Chiriqui.png"))); // NOI18N
                    break;
                case 34:
                    jLabelFotoLocal1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Darien.png"))); // NOI18N
                    break;
                case 35:
                    jLabelFotoLocal1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Herrera.png"))); // NOI18N
                    break;
                case 36:
                    jLabelFotoLocal1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/LosSantos.png"))); // NOI18N
                    break;
                case 37:
                    jLabelFotoLocal1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Metro.png"))); // NOI18N
                    break;
                case 38:
                    jLabelFotoLocal1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/PanamaOeste.png"))); // NOI18N
                    break;
                case 39:
                    jLabelFotoLocal1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Veraguas.png"))); // NOI18N
                    break;
                    case 40:
                    jLabelFotoLocal1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Chiriquio.png"))); // NOI18N
                    break;
                         default :
                        jLabelFotoLocal1.setIcon(null);
            }

        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "CargarFotos Locales()");
        }
    }
    
       private void CargarFotosVisitantes() {
        try {
            jLabelFotoVisitante1.setText("");
            switch (idequipovisitante) {
                case 30:
                    jLabelFotoVisitante1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Bocas.png"))); // NOI18N
                  
                    break;
                case 31:
                    jLabelFotoVisitante1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Cocle.png"))); // NOI18N
                    break;
                case 32:
                    jLabelFotoVisitante1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Colon.png"))); // NOI18N
                    break;
                case 33:
                    jLabelFotoVisitante1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Chiriqui.png"))); // NOI18N
                    break;
                case 34:
                    jLabelFotoVisitante1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Darien.png"))); // NOI18N
                    break;
                case 35:
                    jLabelFotoVisitante1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Herrera.png"))); // NOI18N
                    break;
                case 36:
                    jLabelFotoVisitante1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/LosSantos.png"))); // NOI18N
                    break;
                case 37:
                    jLabelFotoVisitante1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Metro.png"))); // NOI18N
                    break;
                case 38:
                    jLabelFotoVisitante1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/PanamaOeste.png"))); // NOI18N
                    break;
                case 39:
                    jLabelFotoVisitante1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Veraguas.png"))); // NOI18N
                    break;
                    case 40:
                    jLabelFotoVisitante1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cuadroanotacion/resources/gif/logos/Chiriquio.png"))); // NOI18N
                    break;
                         default :
                        jLabelFotoVisitante1.setIcon(null);
            }

        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "CargarFotos Locales()");
        }
    }

    private boolean CargarListaEquipos() {
        try {
            updateProgress("Cargando los equipos");
            jos_fastball_teamlist.removeAll(jos_fastball_teamlist);
            if (!jos_fastball_teamController1.Listar()) {
                Mensajeria.Mensaje("No hay registros de equipos");
                return false;
            }
            jos_fastball_teamlist = jos_fastball_teamController1.getJos_fastball_teamlist();
            updateProgress(" ");
            return true;
        } catch (Exception ex) {
            Mensajeria.Mensaje("CargarListaEquipos()");
        }
        return false;
    }

    private boolean ProcesoInicial() {
        try {
            updateProgress("Iniciando proceso inicial....");
            LimpiarModelo(modeloResultado);
            LimpiarModelo(modeloResultado2);
            LimpiarModelo(modeloResultado3);

            int a = jXComboBoxPartido.getSelectedIndex();

            if (a != -1) {
                jos_fastball_schedule1 = jos_fastball_scheduleController1.getJos_fastball_schedulelist().get(a);
                this.idpartido = jos_fastball_schedule1.getId();
                jTextFieldIdPartido.setText(this.idpartido.toString());
                this.idequipolocal = jos_fastball_schedule1.getHometeam();
                /*
                 *
                 */
                updateProgress("Buscando status....");
                Jos_fastball_gamestatus jos_fastball_gamestatus = new Jos_fastball_gamestatus();
                Jos_fastball_gamestatusController jos_fastball_gamestatusController = new Jos_fastball_gamestatusController();
                jos_fastball_gamestatus.setId(jos_fastball_schedule1.getStatus());
              
                Jos_fastball_gamestatus jos_fastball_gamestatus2 = jos_fastball_gamestatusController.findByPrimaryKey(jos_fastball_gamestatus);
                if (jos_fastball_gamestatus2 != null) {
                    jTextFieldEstatusOld.setText(jos_fastball_gamestatus2.getDescription());
                } else {
                    jTextFieldEstatusOld.setText("");
                }

                equipolocal = ObtenerNombreEquipo(jos_fastball_schedule1.getHometeam());
                jTextFieldLocal.setText(equipolocal);
                jTextFieldEquipoJugadores.setText(equipolocal);
                jTextFieldNombreEquipoLocal1.setText(equipolocal);
                jTextFieldNombreEquipoLocal2.setText(equipolocal);
   CargarFotosLocales();
                this.idequipovisitante = jos_fastball_schedule1.getVisitingteam();

                jos_fastball_team1.setId(jos_fastball_schedule1.getVisitingteam());

                equipovisitante = ObtenerNombreEquipo(jos_fastball_schedule1.getVisitingteam());
                jTextFieldNombreEquipoVisitante1.setText(equipovisitante);
                jTextFieldNombreEquipoVisitante2.setText(equipovisitante);
                jTextFieldVisitante.setText(equipovisitante);
                jTextFieldFecha.setText(jos_fastball_schedule1.getGamedatetime().toString());
                    CargarFotosVisitantes();
                /*
                 * tipo
                 */
                updateProgress("Buscando tipo de juego....");
                jos_fastball_gametype1.setId(jos_fastball_schedule1.getGametype());
                Jos_fastball_gametype jos_fastball_gametype = jos_fastball_gametypeController1.findByPrimaryKey(jos_fastball_gametype1);
                if (jos_fastball_gametype == null) {
                    jTextFieldTipo.setText("");
                } else {
                    jTextFieldTipo.setText(jos_fastball_gametype.getDescription());
                }
                updateProgress("Buscando ubicacion....");
                jos_fastball_location1.setId(jos_fastball_schedule1.getLocation());
                Jos_fastball_location jos_fastball_location = jos_fastball_locationController1.findByPrimaryKey(jos_fastball_location1);
                if (jos_fastball_location == null) {
                    jTextFieldEstadio.setText("");
                } else {
                    jTextFieldEstadio.setText(jos_fastball_location.getName());
                }

            }
            return true;
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "ProcesInicial()");
        }
        return false;
    }

    private boolean ConsultarResultadosIning() {
        try {
            updateProgress("Consultando resultados por ininig....");
            jos_fastball_schedule1.setId(this.idpartido);
            Jos_fastball_schedule jos_fastball_schedule = jos_fastball_scheduleController1.findByPrimaryKey(jos_fastball_schedule1);
            if (jos_fastball_schedule == null) {
                Mensajeria.Mensaje("No hay registros del calendario de juegos para este partido. Debe crearlo primero");
                return false;
            }
            jos_fastball_schedule = jos_fastball_schedule1;
            this.episodio = jos_fastball_schedule1.getInnings();
            jTextFieldEpisodios.setText(this.episodio.toString());
            /*
             * Voy a cargar los episodios
             */

            LimpiarModelo(modeloResultado);
            LimpiarModelo(modeloResultado2);
            LimpiarModelo(modeloResultado3);

            Object[] filas = new Object[14];
            filas[0] = equipolocal;
            for (int i = 1; i < 13; i++) {
                filas[i] = "";
            }
            Integer lepisodio = this.episodio;
            if (this.episodio > 9) {
                lepisodio = 9;
            }
            for (int lining = 1; lining <= lepisodio; lining++) {
                jos_fastball_linescore1.setGameid(this.idpartido);
                jos_fastball_linescore1.setInning(lining);
                updateProgress("Buscando ining...." + lining);
                Jos_fastball_linescore jos_fastball_linescore = jos_fastball_linescoreController1.findByPrimaryKey(jos_fastball_linescore1);
                if (jos_fastball_linescore == null) {
                } else {
                    jos_fastball_linescore1 = jos_fastball_linescore;
                    filas[lining] = jos_fastball_linescore1.getRunshome();
                }
            }
            filas[10] = jos_fastball_schedule1.getRunshome();
            filas[11] = jos_fastball_schedule1.getHitshome();
            filas[12] = jos_fastball_schedule1.getErrorshome();
            modeloResultado.addRow(filas);
            /*
             * visitante
             */
            filas[0] = equipovisitante;

            for (int i = 1; i < 13; i++) {
                filas[i] = "";
            }
            filas[10] = jos_fastball_schedule1.getRunsaway();
            filas[11] = jos_fastball_schedule1.getHitsaway();
            filas[12] = jos_fastball_schedule1.getErrorsaway();
            for (int lining = 1; lining <= lepisodio; lining++) {
                updateProgress("Buscando ining...." + lining);
                jos_fastball_linescore1.setGameid(this.idpartido);
                jos_fastball_linescore1.setInning(lining);
                Jos_fastball_linescore jos_fastball_linescore = jos_fastball_linescoreController1.findByPrimaryKey(jos_fastball_linescore1);
                if (jos_fastball_linescore == null) {
                } else {
                    jos_fastball_linescore1 = jos_fastball_linescore;
                    filas[lining] = jos_fastball_linescore1.getRunsaway();
                }
            }

            modeloResultado.addRow(filas);


            if (this.episodio > 9) {

                filas[0] = equipolocal;
                for (int i = 1; i < 13; i++) {
                    filas[i] = "";
                }
                lepisodio = this.episodio;
                if (this.episodio > 18) {
                    lepisodio = 18;
                }
                for (int lining = 10; lining <= lepisodio; lining++) {
                    updateProgress("Buscando ining...." + lining);
                    jos_fastball_linescore1.setGameid(this.idpartido);
                    jos_fastball_linescore1.setInning(lining);
                    Jos_fastball_linescore jos_fastball_linescore = jos_fastball_linescoreController1.findByPrimaryKey(jos_fastball_linescore1);
                    if (jos_fastball_linescore == null) {
                    } else {
                        jos_fastball_linescore1 = jos_fastball_linescore;
                        filas[lining] = jos_fastball_linescore1.getRunshome();
                    }
                }
                modeloResultado2.addRow(filas);
                /*
                 * visitante
                 */
                filas[0] = equipovisitante;

                for (int i = 1; i < 13; i++) {
                    filas[i] = "";
                }
                lepisodio = this.episodio;
                if (this.episodio > 18) {
                    lepisodio = 18;
                }
                for (int lining = 10; lining <= lepisodio; lining++) {
                    updateProgress("Buscando ining...." + lining);
                    jos_fastball_linescore1.setGameid(this.idpartido);
                    jos_fastball_linescore1.setInning(lining);
                    Jos_fastball_linescore jos_fastball_linescore = jos_fastball_linescoreController1.findByPrimaryKey(jos_fastball_linescore1);
                    if (jos_fastball_linescore == null) {
                    } else {
                        jos_fastball_linescore1 = jos_fastball_linescore;
                        filas[lining] = jos_fastball_linescore1.getRunsaway();
                    }
                }
                modeloResultado2.addRow(filas);
            }
            if (this.episodio > 18) {

                filas[0] = equipolocal;
                for (int i = 1; i < 13; i++) {
                    filas[i] = "";
                }
                lepisodio = this.episodio;
                if (this.episodio > 27) {
                    lepisodio = 27;
                }
                for (int lining = 19; lining <= lepisodio; lining++) {
                    updateProgress("Buscando ining...." + lining);
                    jos_fastball_linescore1.setGameid(this.idpartido);
                    jos_fastball_linescore1.setInning(lining);
                    Jos_fastball_linescore jos_fastball_linescore = jos_fastball_linescoreController1.findByPrimaryKey(jos_fastball_linescore1);
                    if (jos_fastball_linescore == null) {
                    } else {
                        jos_fastball_linescore1 = jos_fastball_linescore;
                        filas[lining] = jos_fastball_linescore1.getRunshome();
                    }
                }
                modeloResultado3.addRow(filas);
                /*
                 * visitante
                 */
                filas[0] = equipovisitante;

                for (int i = 1; i < 13; i++) {
                    filas[i] = "";
                }
                lepisodio = this.episodio;
                if (this.episodio > 27) {
                    lepisodio = 27;
                }
                for (int lining = 19; lining <= lepisodio; lining++) {
                    updateProgress("Buscando ining...." + lining);
                    jos_fastball_linescore1.setGameid(this.idpartido);
                    jos_fastball_linescore1.setInning(lining);
                    Jos_fastball_linescore jos_fastball_linescore = jos_fastball_linescoreController1.findByPrimaryKey(jos_fastball_linescore1);
                    if (jos_fastball_linescore == null) {
                    } else {
                        jos_fastball_linescore1 = jos_fastball_linescore;
                        filas[lining] = jos_fastball_linescore1.getRunshome();
                    }
                }
                modeloResultado3.addRow(filas);
            }
            return true;
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "ConsultarResultadosIning()");
        }
        return false;
    }

    private boolean ConsultarResultadosJugadores() {
        try {
            LimpiarModelo(modeloPitchingLocal);
            LimpiarModelo(modeloPitchingVisitante);
            LimpiarModelo(modeloHittingLocal);
            LimpiarModelo(modeloHittingVisitante);
            jos_fastball_playerstat1.setGameid(this.idpartido);
            updateProgress("Buscando estadisticas");
            boolean esjugadorlocal = false;
            if (jos_fastball_playerstatController1.findByGameid(jos_fastball_playerstat1)) {
                for (Jos_fastball_playerstat jos_fastball_playerstat : jos_fastball_playerstatController1.getJos_fastball_playerstatlist()) {
                    Object[] filash = new Object[29];//hitting
                    Object[] filasp = new Object[22];//pitchinh
                    esjugadorlocal = false;
                    filash[0] = false;
                    filasp[0] = false;
                    filash[1] = jos_fastball_playerstat.getBattingorder();
                    filasp[1] = jos_fastball_playerstat.getBattingorder();
                    filash[2] = jos_fastball_playerstat.getPlayerid();
                    filasp[2] = jos_fastball_playerstat.getPlayerid();
                    /*
                     * busco nombre del jugador
                     */
                    updateProgress("Buscando jugador " + jos_fastball_playerstat.getPlayerid());
                    jos_fastball_player1.setId(jos_fastball_playerstat.getPlayerid());
                    Jos_fastball_player jos_fastball_player = jos_fastball_playerController1.findByPrimaryKey(jos_fastball_player1);
                    if (jos_fastball_player == null) {
                        esjugadorlocal = false;
                        filash[3] = "";
                        filasp[3] = "";
                    } else {
                        jos_fastball_player = jos_fastball_player1;
                        filash[3] = jos_fastball_player1.getLname() + " " + jos_fastball_player1.getFname();
                        filasp[3] = jos_fastball_player1.getLname() + " " + jos_fastball_player1.getFname();
                        if (jos_fastball_player.getTeamid() == this.idequipolocal) {
                            esjugadorlocal = true;
                        } else {
                            esjugadorlocal = false;
                        }
                    }
                    filash[4] = jos_fastball_playerstat.getHitting_pa();
                    filash[5] = jos_fastball_playerstat.getHitting_1b();
                    filash[6] = jos_fastball_playerstat.getHitting_2b();
                    filash[7] = jos_fastball_playerstat.getHitting_3b();
                    filash[8] = jos_fastball_playerstat.getHitting_hr();
                    filash[9] = jos_fastball_playerstat.getHitting_rbi();
                    filash[10] = jos_fastball_playerstat.getHitting_bb();
                    filash[11] = jos_fastball_playerstat.getHitting_k();
                    filash[12] = jos_fastball_playerstat.getHitting_hbp();
                    filash[13] = jos_fastball_playerstat.getHitting_roe();
                    filash[14] = jos_fastball_playerstat.getHitting_fc();
                    filash[15] = jos_fastball_playerstat.getHitting_sac();
                    filash[16] = jos_fastball_playerstat.getHitting_dp();
                    filash[17] = jos_fastball_playerstat.getRunning_r();
                    filash[18] = jos_fastball_playerstat.getRunning_sb();
                    filash[19] = jos_fastball_playerstat.getRunning_cs();
                    filash[20] = jos_fastball_playerstat.getRunning_lob();
                    filash[21] = jos_fastball_playerstat.getFielding_asst();
                    filash[22] = jos_fastball_playerstat.getFielding_po();
                    filash[23] = jos_fastball_playerstat.getFielding_e();
                    filash[24] = jos_fastball_playerstat.getCatching_ic();
                    filash[25] = jos_fastball_playerstat.getCatching_pb();
                    filash[26] = jos_fastball_playerstat.getCatching_sb();
                    filash[27] = jos_fastball_playerstat.getCatching_cs();
                    filash[28] = jos_fastball_playerstat.getCatching_co();
                    /*
                     * hitting
                     */

                    if (esjugadorlocal) {
                        modeloHittingLocal.addRow(filash);
                    } else {
                        modeloHittingVisitante.addRow(filash);
                    }
                    //PITCHING
                    filasp[4] = jos_fastball_playerstat.getPitching_inn();
                    // filasp[5] = jos_fastball_playerstat.getPitching_inn_p();
                    switch (jos_fastball_playerstat.getPitching_inn_p()) {
                        case 0:
                            filasp[5] = "--";
                            break;
                        case 333:
                            filasp[5] = "1/3";
                            break;
                        case 666:
                            filasp[5] = "2/3";
                            break;
                        default:
                            filasp[5] = "--";
                            break;

                    }
                    filasp[6] = jos_fastball_playerstat.getPitching_count();
                    filasp[7] = jos_fastball_playerstat.getPitching_bf();
                    filasp[8] = jos_fastball_playerstat.getPitching_ab();
                    filasp[9] = jos_fastball_playerstat.getPitching_h();
                    filasp[10] = jos_fastball_playerstat.getPitching_r();
                    filasp[11] = jos_fastball_playerstat.getPitching_er();
                    filasp[12] = jos_fastball_playerstat.getPitching_bb();
                    filasp[13] = jos_fastball_playerstat.getPitching_k();
                    filasp[14] = jos_fastball_playerstat.getPitching_hr();
                    filasp[15] = jos_fastball_playerstat.getPitching_wp();
                    filasp[16] = jos_fastball_playerstat.getPitching_hb();
                    if (jos_fastball_playerstat.getPitching_w() == 1) {
                        filasp[17] = true;
                    } else {
                        filasp[17] = false;
                    }
                    if (jos_fastball_playerstat.getPitching_l() == 1) {
                        filasp[18] = true;
                    } else {
                        filasp[18] = false;
                    }
                    if (jos_fastball_playerstat.getPitching_s() == 1) {
                        filasp[19] = true;
                    } else {
                        filasp[19] = false;
                    }
                    if (jos_fastball_playerstat.getPitching_cg() == 1) {
                        filasp[20] = true;
                    } else {
                        filasp[20] = false;
                    }
                    if (jos_fastball_playerstat.getPitching_sho() == 1) {
                        filasp[21] = true;
                    } else {
                        filasp[21] = false;
                    }


                    if (esjugadorlocal) {
                        modeloPitchingLocal.addRow(filasp);
                    } else {
                        modeloPitchingVisitante.addRow(filasp);
                    }




                }//for

            } else {
                //No hay estadisticas del juego
                Mensajeria.Mensaje("No hay estadisticas de los jugadores en este partido");
                ConsultarEstadisticasdeJuegoBlanco();
            }


            /*
             * Cargar Los resultados por inin
             */


            return true;
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "ConsultarResultadosJugadores()");
        }
        return false;
    }

    private boolean ConsultarEstadisticasdeJuegoBlanco() {
        try {
            updateProgress("procesando estadisticas de juego");
            /*
             * hitting
             */
            Object[] filash = new Object[29];

            jos_fastball_player1.setTeamid(this.idequipolocal);
            if (jos_fastball_playerController1.findByTeamid(jos_fastball_player1)) {
                for (Jos_fastball_player j : jos_fastball_playerController1.getJos_fastball_playerlist()) {
                    filash[0] = false;
                    filash[1] = "0";
                    filash[2] = j.getPlayerid();
                    filash[3] = j.getLname() + " " + j.getFname();
                    for (int i = 4; i < 29; i++) {
                        filash[i] = "";
                    }

                    modeloHittingLocal.addRow(filash);
                }
            } else {
                Mensajeria.Mensaje("No hay jugadores para el equipo local: " + this.equipolocal + "\nMensaje: " + jos_fastball_playerController1.getMensaje());
                return false;
            }

            jos_fastball_player1.setTeamid(this.idequipovisitante);
            if (jos_fastball_playerController1.findByTeamid(jos_fastball_player1)) {
                for (Jos_fastball_player j : jos_fastball_playerController1.getJos_fastball_playerlist()) {
                    filash[0] = false;
                    filash[1] = "0";
                    filash[2] = j.getPlayerid();
                    filash[3] = j.getLname() + " " + j.getFname();
                    for (int i = 4; i < 29; i++) {
                        filash[i] = "";
                    }
                    modeloHittingVisitante.addRow(filash);
                }
            } else {
                Mensajeria.Mensaje("No hay jugadores para el equipo visitante: " + this.equipovisitante + "\nMensaje: " + jos_fastball_playerController1.getMensaje());
                return false;
            }
            /*
             * pitchingLocal
             */
            Object[] filasp = new Object[22];

            jos_fastball_player1.setTeamid(this.idequipolocal);
            if (jos_fastball_playerController1.findByTeamid(jos_fastball_player1)) {
                for (Jos_fastball_player j : jos_fastball_playerController1.getJos_fastball_playerlist()) {
                    filasp[0] = false;
                    filasp[1] = "";
                    filasp[2] = j.getPlayerid();
                    filasp[3] = j.getLname() + " " + j.getFname();
//                    for (int i = 6; i < 22; i++) {
//                        filasp[i] = "";
//                    }

                    modeloPitchingLocal.addRow(filasp);
                }
            } else {
                Mensajeria.Mensaje("No hay jugadores para el equipo local: " + this.equipolocal + "\nMensaje: " + jos_fastball_playerController1.getMensaje());
                return false;
            }


            jos_fastball_player1.setTeamid(this.idequipovisitante);
            if (jos_fastball_playerController1.findByTeamid(jos_fastball_player1)) {
                for (Jos_fastball_player j : jos_fastball_playerController1.getJos_fastball_playerlist()) {
                    filasp[0] = false;
                    filasp[1] = "";
                    filasp[2] = j.getPlayerid();
                    filasp[3] = j.getLname() + " " + j.getFname();
//                    for (int i = 6; i < 22; i++) {
//                        filasp[i] = "";
//                    }

                    modeloPitchingVisitante.addRow(filasp);
                }
            } else {
                Mensajeria.Mensaje("No hay jugadores para el equipo visitante: " + this.equipovisitante + "\nMensaje: " + jos_fastball_playerController1.getMensaje());
                return false;
            }

            return true;
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "ConsultarResultadosJugadores()");
        }
        return false;
    }

    private boolean ConvertiraCero(String nmodelo, DefaultTableModel lmodelo, int columna) {
        try {
            updateProgress("Convertir a cero...");
            for (int fila = 0; fila < lmodelo.getRowCount(); fila++) {

                for (int col = columna; col < lmodelo.getColumnCount(); col++) {
                    if (nmodelo.equals("PitchingLocal") || nmodelo.equals("PitchingVisitante")) {
                        if (col == 5 || col == 17 || col == 18 || col == 19 || col == 20 || col == 21) {
                        } else {
                            if (lmodelo.getValueAt(fila, col) == null || lmodelo.getValueAt(fila, col).toString().equals("")) {
                                lmodelo.setValueAt(0, fila, col);
                            } else {
                                if (!isNumeric(lmodelo.getValueAt(fila, col).toString())) {
                                    Mensajeria.Mensaje("En la tabla: " + nmodelo + "\n El valor " + lmodelo.getValueAt(fila, col).toString() + "\n No es un numero");
                                    return false;
                                }
                            }

                        }
                    } else {
                        if (lmodelo.getValueAt(fila, col) == null || lmodelo.getValueAt(fila, col).toString().equals("")) {
                            lmodelo.setValueAt(0, fila, col);
                        } else {
                            if (!isNumeric(lmodelo.getValueAt(fila, col).toString())) {
                                Mensajeria.Mensaje("En la tabla: " + nmodelo + "\n El valor " + lmodelo.getValueAt(fila, col).toString() + "\n No es un numero");
                                return false;
                            }
                        }
                    }

                }//for col
            }//for fila
            return true;
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "ConvertiraCero() " + nmodelo);
        }
        return false;
    }

    private Integer PosicionMarcado(DefaultTableModel lmodelo, int columna) {
        try {
            for (int fila = 0; fila < lmodelo.getRowCount(); fila++) {
                if (lmodelo.getValueAt(fila, columna).equals(true)) {
                    return fila;
                }
            }
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "PosicionMarcado()");
        }
        return -1;
    }
    private void jButtonEliminar2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEliminar2ActionPerformed
        try {
            int pos;
            while (true) {
                pos = PosicionMarcado(modeloPitchingLocal, 0);
                if (pos != -1) {
                    modeloPitchingLocal.removeRow(pos);
                } else {
                    break;
                }
            }

        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Eliminar");
        }


    }//GEN-LAST:event_jButtonEliminar2ActionPerformed

    private void jButtonEliminar3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEliminar3ActionPerformed
        try {
            int pos;
            while (true) {
                pos = PosicionMarcado(modeloHittingVisitante, 0);
                if (pos != -1) {
                    modeloHittingVisitante.removeRow(pos);
                } else {
                    break;
                }
            }

        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Eliminar");
        }
    }//GEN-LAST:event_jButtonEliminar3ActionPerformed

    private void jButtonEliminar4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEliminar4ActionPerformed
        try {

            int pos;
            while (true) {
                pos = PosicionMarcado(modeloPitchingVisitante, 0);
                if (pos != -1) {
                    modeloPitchingVisitante.removeRow(pos);
                } else {
                    break;
                }
            }


        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Eliminar");
        }
    }//GEN-LAST:event_jButtonEliminar4ActionPerformed

    private void jButtonGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGuardarActionPerformed
        try {
            HiloGuardar();
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Guardar()");
        }
        //     jButtonGuardar.setEnabled(true);
    }//GEN-LAST:event_jButtonGuardarActionPerformed

    private void jXComboBoxEstatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jXComboBoxEstatusActionPerformed
        try {
            int a = jXComboBoxEstatus.getSelectedIndex();
            if (a != -1) {
                jos_fastball_gamestatus1 = jos_fastball_gamestatusController1.getJos_fastball_gamestatuslist().get(a);
                this.estatus = jos_fastball_gamestatus1.getId();
                //   jButtonGuardar.setEnabled(true);
            }

        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "ComboBoxEstatus()");
        }
    }//GEN-LAST:event_jXComboBoxEstatusActionPerformed

    private void jButtonAgregarJugadoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAgregarJugadoresActionPerformed

        try {
            controlLlamado = "HittingLocal";
            jButtonAgregar.setEnabled(true);
            LimpiarModelo(modeloJugadores);

            Integer contadorJugadores = 0;
            jTextFieldEquipoJugadores.setText(equipolocal);
            Jos_fastball_player jos_fastball_player = new Jos_fastball_player();
            Jos_fastball_playerController jos_fastball_playerController = new Jos_fastball_playerController();
            jos_fastball_player.setTeamid(this.idequipolocal);
            Object[] fila = new Object[5];
            if (jos_fastball_playerController.findByTeamid(jos_fastball_player)) {
                for (Jos_fastball_player j : jos_fastball_playerController.getJos_fastball_playerlist()) {

// bucarlo para ver si esta en la tabla

                    boolean encontrado = false;

                    for (int i = 0; i < modeloHittingLocal.getRowCount(); i++) {

                        if (modeloHittingLocal.getValueAt(i, 2).toString().equals(j.getPlayerid().toString())) {

                            encontrado = true;
                        }
                    }
                    if (!encontrado) {
                        contadorJugadores++;
                        fila[0] = false;
                        fila[1] = "0";
                        fila[2] = j.getPlayerid();
                        fila[3] = j.getJerseyhome();

                        fila[4] = j.getLname() + " " + j.getFname();
                        modeloJugadores.addRow(fila);
                    }
                }
            } else {
                Mensajeria.Mensaje("No hay jugadores para el equipo local " + jos_fastball_playerController.getMensaje());
            }
            if (contadorJugadores == 0) {
                Mensajeria.Mensaje(" Todos los jugadores del equipo ya estan en la lista");
                return;
            }
            jDialogAgregar.setSize(564, 550);
            jDialogAgregar.setLocationRelativeTo(this);
            jDialogAgregar.setVisible(true);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Agregar()");
        }

    }//GEN-LAST:event_jButtonAgregarJugadoresActionPerformed

    private void jTextFieldEquipoJugadoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldEquipoJugadoresActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldEquipoJugadoresActionPerformed

    private void jButtonCerrar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCerrar1ActionPerformed
        jDialogAgregar.dispose();
    }//GEN-LAST:event_jButtonCerrar1ActionPerformed

    private void jButtonAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAgregarActionPerformed
        try {

            Object[] filash = new Object[29];
            Object[] filasp = new Object[22];
            int pos;
            switch (controlLlamado) {
                case "HittingLocal":
                    jTextFieldEquipoJugadores.setText(equipolocal);
                    for (int fila = 0; fila < modeloJugadores.getRowCount(); fila++) {
                        if (modeloJugadores.getValueAt(fila, 0).equals(true)) {
                            // esta marcado para agregarse 
                            filash[0] = false;
                            filash[1] = modeloJugadores.getValueAt(fila, 1);
                            filash[2] = modeloJugadores.getValueAt(fila, 2);
                            filash[3] = modeloJugadores.getValueAt(fila, 4);
                            for (int i = 4; i < 29; i++) {
                                filash[i] = "";
                            }

                            modeloHittingLocal.addRow(filash);
                        }
                    }

                    break;
                case "HittingVisitante":
                    jTextFieldEquipoJugadores.setText(equipovisitante);
                    for (int fila = 0; fila < modeloJugadores.getRowCount(); fila++) {
                        if (modeloJugadores.getValueAt(fila, 0).equals(true)) {
                            // esta marcado para agregarse 
                            filash[0] = false;
                            filash[1] = modeloJugadores.getValueAt(fila, 1);
                            filash[2] = modeloJugadores.getValueAt(fila, 2);
                            filash[3] = modeloJugadores.getValueAt(fila, 4);
                            for (int i = 4; i < 29; i++) {
                                filash[i] = "";
                            }

                            modeloHittingVisitante.addRow(filash);
                        }
                    }

                    break;
                case "PitchingLocal":
                    jTextFieldEquipoJugadores.setText(equipolocal);
                    for (int fila = 0; fila < modeloJugadores.getRowCount(); fila++) {
                        if (modeloJugadores.getValueAt(fila, 0).equals(true)) {
                            // esta marcado para agregarse 
                            filasp[0] = false;
                            filasp[1] = modeloJugadores.getValueAt(fila, 1);
                            filasp[2] = modeloJugadores.getValueAt(fila, 2);
                            filasp[3] = modeloJugadores.getValueAt(fila, 4);
//                            for (int i = 6; i < 22; i++) {
//                                filasp[i] = "";
//                            }

                            modeloPitchingLocal.addRow(filasp);
                        }
                    }
                    break;
                case "PitchingVisitante":
                    jTextFieldEquipoJugadores.setText(equipovisitante);
                    for (int fila = 0; fila < modeloJugadores.getRowCount(); fila++) {
                        if (modeloJugadores.getValueAt(fila, 0).equals(true)) {
                            // esta marcado para agregarse 
                            filasp[0] = false;
                            filasp[1] = modeloJugadores.getValueAt(fila, 1);
                            filasp[2] = modeloJugadores.getValueAt(fila, 2);
                            filasp[3] = modeloJugadores.getValueAt(fila, 4);
//                            for (int i = 6; i < 22; i++) {
//                                filasp[i] = "";
//                            }

                            modeloPitchingVisitante.addRow(filasp);
                        }
                    }
                    break;
                default:
                    Mensajeria.Mensaje("el codigo interno de controlllamado no es correcto");
                    jDialogAgregar.dispose();
                    return;
            }

            while (true) {
                pos = PosicionMarcado(modeloJugadores, 0);
                if (pos != -1) {
                    modeloJugadores.removeRow(pos);
                } else {
                    break;
                }
            }
            if (modeloJugadores.getRowCount() == 0) {
                jButtonAgregar.setEnabled(false);
            }
jDialogAgregar.dispose();
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "BotonAgregar()");
        }
    }//GEN-LAST:event_jButtonAgregarActionPerformed

    private void jButtonAgregarJugadoresHittingVisitanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAgregarJugadoresHittingVisitanteActionPerformed

        try {
            controlLlamado = "HittingVisitante";
            jButtonAgregar.setEnabled(true);
            LimpiarModelo(modeloJugadores);

            Integer contadorJugadores = 0;
            jTextFieldEquipoJugadores.setText(equipovisitante);
            Jos_fastball_player jos_fastball_player = new Jos_fastball_player();
            Jos_fastball_playerController jos_fastball_playerController = new Jos_fastball_playerController();
            jos_fastball_player.setTeamid(this.idequipovisitante);
            Object[] fila = new Object[5];
            if (jos_fastball_playerController.findByTeamid(jos_fastball_player)) {
                for (Jos_fastball_player j : jos_fastball_playerController.getJos_fastball_playerlist()) {

// bucarlo para ver si esta en la tabla

                    boolean encontrado = false;

                    for (int i = 0; i < modeloHittingVisitante.getRowCount(); i++) {

                        if (modeloHittingVisitante.getValueAt(i, 2).toString().equals(j.getPlayerid().toString())) {

                            encontrado = true;
                        }
                    }
                    if (!encontrado) {
                        contadorJugadores++;
                        fila[0] = false;
                        fila[1] = "0";
                        fila[2] = j.getPlayerid();
                        fila[3] = j.getJerseyhome();

                        fila[4] = j.getLname() + " " + j.getFname();
                        modeloJugadores.addRow(fila);
                    }
                }
            } else {
                Mensajeria.Mensaje("No hay jugadores para el equipo visitante " + jos_fastball_playerController.getMensaje());
            }
            if (contadorJugadores == 0) {
                Mensajeria.Mensaje(" Todos los jugadores del equipo ya estan en la lista");
                return;
            }
            jDialogAgregar.setSize(564, 550);
            jDialogAgregar.setLocationRelativeTo(this);
            jDialogAgregar.setVisible(true);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Agregar()");
        }
    }//GEN-LAST:event_jButtonAgregarJugadoresHittingVisitanteActionPerformed

    private void jButtonAgregarJugadorPittchingLocalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAgregarJugadorPittchingLocalActionPerformed
        try {
            controlLlamado = "PitchingLocal";
            jButtonAgregar.setEnabled(true);
            LimpiarModelo(modeloJugadores);

            Integer contadorJugadores = 0;
            jTextFieldEquipoJugadores.setText(equipolocal);
            Jos_fastball_player jos_fastball_player = new Jos_fastball_player();
            Jos_fastball_playerController jos_fastball_playerController = new Jos_fastball_playerController();
            jos_fastball_player.setTeamid(this.idequipolocal);
            Object[] fila = new Object[5];
            if (jos_fastball_playerController.findByTeamid(jos_fastball_player)) {
                for (Jos_fastball_player j : jos_fastball_playerController.getJos_fastball_playerlist()) {

// bucarlo para ver si esta en la tabla

                    boolean encontrado = false;

                    for (int i = 0; i < modeloPitchingLocal.getRowCount(); i++) {

                        if (modeloPitchingLocal.getValueAt(i, 2).toString().equals(j.getPlayerid().toString())) {

                            encontrado = true;
                        }
                    }
                    if (!encontrado) {
                        contadorJugadores++;
                        fila[0] = false;
                        fila[1] = "0";
                        fila[2] = j.getPlayerid();
                        fila[3] = j.getJerseyhome();

                        fila[4] = j.getLname() + " " + j.getFname();
                        modeloJugadores.addRow(fila);
                    }
                }
            } else {
                Mensajeria.Mensaje("No hay jugadores para el equipo local " + jos_fastball_playerController.getMensaje());
            }
            if (contadorJugadores == 0) {
                Mensajeria.Mensaje(" Todos los jugadores del equipo ya estan en la lista");
                return;
            }
            jDialogAgregar.setSize(564, 550);
            jDialogAgregar.setLocationRelativeTo(this);
            jDialogAgregar.setVisible(true);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Agregar()");
        }

    }//GEN-LAST:event_jButtonAgregarJugadorPittchingLocalActionPerformed

    private void jButtonAgregarPittchingVisitanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAgregarPittchingVisitanteActionPerformed
        try {
            controlLlamado = "PitchingVisitante";
            jButtonAgregar.setEnabled(true);
            LimpiarModelo(modeloJugadores);

            Integer contadorJugadores = 0;
            jTextFieldEquipoJugadores.setText(equipovisitante);
            Jos_fastball_player jos_fastball_player = new Jos_fastball_player();
            Jos_fastball_playerController jos_fastball_playerController = new Jos_fastball_playerController();
            jos_fastball_player.setTeamid(this.idequipovisitante);
            Object[] fila = new Object[5];
            if (jos_fastball_playerController.findByTeamid(jos_fastball_player)) {
                for (Jos_fastball_player j : jos_fastball_playerController.getJos_fastball_playerlist()) {

// bucarlo para ver si esta en la tabla

                    boolean encontrado = false;

                    for (int i = 0; i < modeloPitchingVisitante.getRowCount(); i++) {

                        if (modeloPitchingVisitante.getValueAt(i, 2).toString().equals(j.getPlayerid().toString())) {

                            encontrado = true;
                        }
                    }
                    if (!encontrado) {
                        contadorJugadores++;
                        fila[0] = false;
                        fila[1] = "0";
                        fila[2] = j.getPlayerid();
                        fila[3] = j.getJerseyhome();

                        fila[4] = j.getLname() + " " + j.getFname();
                        modeloJugadores.addRow(fila);
                    }
                }
            } else {
                Mensajeria.Mensaje("No hay jugadores para el equipo local " + jos_fastball_playerController.getMensaje());
            }
            if (contadorJugadores == 0) {
                Mensajeria.Mensaje(" Todos los jugadores del equipo ya estan en la lista");
                return;
            }
            jDialogAgregar.setSize(564, 550);
            jDialogAgregar.setLocationRelativeTo(this);
            jDialogAgregar.setVisible(true);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Agregar()");
        }
    }//GEN-LAST:event_jButtonAgregarPittchingVisitanteActionPerformed

    private void jButtonSeleccionarTodoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSeleccionarTodoActionPerformed
        try {
            SeleccionarTodo(modeloHittingLocal, 0);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Agregar()");
        }
    }//GEN-LAST:event_jButtonSeleccionarTodoActionPerformed

    private void jButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonActionPerformed
        try {
            DeSeleccionarTodo(modeloHittingLocal, 0);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Agregar()");
        }
    }//GEN-LAST:event_jButtonActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        try {
            SeleccionarTodo(modeloPitchingLocal, 0);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Agregar()");
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        try {
            DeSeleccionarTodo(modeloPitchingLocal, 0);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Agregar()");
        }
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        try {
            SeleccionarTodo(modeloHittingVisitante, 0);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Agregar()");
        }
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        try {
            DeSeleccionarTodo(modeloHittingVisitante, 0);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Agregar()");
        }
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        try {
            SeleccionarTodo(modeloPitchingVisitante, 0);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Agregar()");
        }
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        try {
            DeSeleccionarTodo(modeloPitchingVisitante, 0);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Agregar()");
        }

    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButtonEstablecerEpisodiosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEstablecerEpisodiosActionPerformed
        jDialogIning.setSize(564, 350);
        jDialogIning.setLocationRelativeTo(this);
        jDialogIning.setVisible(true);
        jButtonGuardar.setEnabled(true);
    }//GEN-LAST:event_jButtonEstablecerEpisodiosActionPerformed

    private void jTextFieldEpisodiosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldEpisodiosActionPerformed
        ProcesarIning();
    }//GEN-LAST:event_jTextFieldEpisodiosActionPerformed

    private void jTextFieldEpisodiosDialogoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldEpisodiosDialogoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldEpisodiosDialogoActionPerformed

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        try {
            String ln = jTextFieldEpisodiosDialogo.getText();
            if (isNumeric(ln)) {
                this.episodio = Integer.parseInt(ln);
                jTextFieldEpisodios.setText(ln);
                ProcesarIning();
                jDialogIning.dispose();
            } else {
                Mensajeria.Mensaje("Debe introducir la cantidad de episodios jugados");
                return;
            }
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Boton EpisodiosDialogo()");
        }
    }//GEN-LAST:event_jButton8ActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed

        varControl = "save";
        LimpiarTodosLosDatos();
        jDialogMensajesResultados.dispose();
    }//GEN-LAST:event_jButton7ActionPerformed

    private void jDialogMensajesResultadosWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_jDialogMensajesResultadosWindowClosed
    }//GEN-LAST:event_jDialogMensajesResultadosWindowClosed

    private void jDialogMensajesResultadosWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_jDialogMensajesResultadosWindowClosing

        varControl = "save";
        LimpiarTodosLosDatos();
    }//GEN-LAST:event_jDialogMensajesResultadosWindowClosing
    private void HiloIniciar() {
        Thread queryThread = new Thread() {

            public void run() {
                runQueries();
            }
        };
        queryThread.start();
    }

    private void HiloCargar() {
        Thread queryThread = new Thread() {

            public void run() {
                runQueriesCargar();
            }
        };
        queryThread.start();
    }

    private void HiloGuardar() {
        Thread queryThread = new Thread() {

            public void run() {
                runQueriesGuardar();
            }
        };
        queryThread.start();
    }

    private void runQueries() {
        try {
            CargarTemporada();
            CargarEstatus();
            CargarListaJugadores();
            updateProgress("Ahora presione el boton CARGAR");

        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "runQueries()");
        }
    }

    private void runQueriesCargar() {
        try {
            switch (varControl) {
                case "started":
                case "save":
                    varControl = "load";
                    break;
                case "load":
                    if (Mensajeria.PreguntaSiNo("El juego anterior no se ha guardado.\nSi Continua perdera los datos\nDesea cargar otro juego", "Cargar Juego Nuevo sin Guardar").equals("si")) {
                    } else {
                        return;
                    }
            }

            if (!ProcesoInicial()) {
                return;
            }


            ConsultarResultadosIning();
            ConsultarResultadosJugadores();
updateProgress("Ya puede modificar los datos");
            jButtonGuardar.setEnabled(true);
            jButtonEstablecerEpisodios.setEnabled(true);


        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "runQueries()");
        }
    }

    private void runQueriesGuardar() {
        try {
             updateProgress("Verificando los datos para guardar...");
            sbMensajes.delete(0, sbMensajes.length());
            sbMensajes.append("\nProceso terminado");
            if (this.idpartido <= 0) {
                Mensajeria.Mensaje("Debe seleccionar un partido primero");
                jButtonGuardar.setEnabled(false);
                return;
            }
            this.episodio = Integer.parseInt(jTextFieldEpisodios.getText());

            if (this.episodio <= 0) {
                Mensajeria.Mensaje("El numero de episodios no debe ser cero o negativo");
                return;
            }
            int a = jXComboBoxEstatus.getSelectedIndex();
            if (a != -1) {
                jos_fastball_gamestatus1 = jos_fastball_gamestatusController1.getJos_fastball_gamestatuslist().get(a);
                this.estatus = jos_fastball_gamestatus1.getId();
                if (this.estatus == 1) {
                    Mensajeria.Mensaje("Debe cambiar el estatus del juego");
                    return;
                }

            } else {
                Mensajeria.Mensaje("Seleccione el estatus");
            }
            if (!ConvertiraCero("Resultado", modeloResultado, 1)) {
                return;
            }

            if (!ConvertiraCero("Resultado2", modeloResultado2, 1)) {
                return;
            }

            if (!ConvertiraCero("Resultado3", modeloResultado3, 1)) {
                return;
            }

            if (!ConvertiraCero("HittingLocal", modeloHittingLocal, 4)) {
                return;
            }

            if (!ConvertiraCero("HittingVisitante", modeloHittingVisitante, 4)) {
                return;
            }

            if (!ConvertiraCero("PitchingLocal", modeloPitchingLocal, 4)) {
                return;
            }

            if (!ConvertiraCero("PitchingVisitante", modeloPitchingVisitante, 4)) {
                return;
            }

            if (!VerificarMacador()) {
                return;
            }
updateProgress("Iniciando guardar local....");
            /*
             * Recorro la tabla de hitting
             */
            String sql = "gameid='" + this.idpartido + "'";
            if (jos_fastball_playerstatController1.Eliminar(sql)) {
            } else {
                sbMensajes.append("\nNo se puede eliminar los registros de estadisticas de juego " + jos_fastball_playerstatController1.getMensaje());
            }
            jButtonGuardar.setEnabled(false);
            if (!ActualizarCalendario()) {
                sbMensajes.append("\nNo se actualizo el calendario");

            } else {
                sbMensajes.append("\nSe actualizo el calendario");
            }

            if (!GuardarIning()) {
                sbMensajes.append("\nNo se guardo los resultados de los ining");
            } else {
                sbMensajes.append("\nSe guardo los resultados de los ining");
            }
            if (!GuardarModelo(modeloHittingLocal, modeloPitchingLocal, "local")) {
                sbMensajes.append("\nNo se guardo las estadistcias de los jugadores locales");
            } else {
                sbMensajes.append("\nSe guardo las estadistcias de los jugadores locales");
            }
            if (!GuardarModelo(modeloHittingVisitante, modeloPitchingVisitante, "visitante")) {
                sbMensajes.append("\nNo se guardo las estadistcias de los jugadores visitantes");
            } else {
                sbMensajes.append("\nSe guardo las estadistcias de los jugadores visitantes");
            }
            jTextArea1.setText(sbMensajes.toString());
            jDialogMensajesResultados.setSize(664, 550);
            jDialogMensajesResultados.setLocationRelativeTo(this);
            jDialogMensajesResultados.setVisible(true);
            updateProgress("");
            updateProgress("");
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "runQueriesGuardar()");
        }
    }

      private boolean GuardarModelo(DefaultTableModel lmodelo, DefaultTableModel lmodeloPitching, String namemodelo) {

        try {


            /*
             * Recorro la tabla de hitting
             */
            int nregistros = lmodelo.getRowCount();

            // Integer x = jos_fastball_playerstatController1.Contador();
            Integer mx = jos_fastball_playerstatController1.Func("max", "id").intValue();
            Integer x = mx + 1;

            //  sbMensajes.append("\nGuardar modelo "+namemodelo + "numero filas: "+nregistros + "x:"+x);
            for (int i = 0; i < nregistros; i++) {

                jos_fastball_playerstat1.setId(x++);




                jos_fastball_playerstat1.setGameid(this.idpartido);
                jos_fastball_playerstat1.setHomeflag(false);
                jos_fastball_playerstat1.setEntered(false);
                Integer h = Integer.parseInt(lmodelo.getValueAt(i, 5).toString()) + Integer.parseInt(lmodelo.getValueAt(i, 6).toString()) + Integer.parseInt(lmodelo.getValueAt(i, 7).toString()) + Integer.parseInt(lmodelo.getValueAt(i, 8).toString());
                jos_fastball_playerstat1.setHitting_h(h);

                jos_fastball_playerstat1.setPlayerid(Integer.parseInt(lmodelo.getValueAt(i, 2).toString()));

                jos_fastball_playerstat1.setBattingorder(Integer.parseInt(lmodelo.getValueAt(i, 1).toString()));

                jos_fastball_playerstat1.setHitting_pa(Integer.parseInt(lmodelo.getValueAt(i, 4).toString()));
                jos_fastball_playerstat1.setHitting_1b(Integer.parseInt(lmodelo.getValueAt(i, 5).toString()));
                jos_fastball_playerstat1.setHitting_2b(Integer.parseInt(lmodelo.getValueAt(i, 6).toString()));
                jos_fastball_playerstat1.setHitting_3b(Integer.parseInt(lmodelo.getValueAt(i, 7).toString()));
                jos_fastball_playerstat1.setHitting_hr(Integer.parseInt(lmodelo.getValueAt(i, 8).toString()));
                jos_fastball_playerstat1.setHitting_rbi(Integer.parseInt(lmodelo.getValueAt(i, 9).toString()));
                jos_fastball_playerstat1.setHitting_bb(Integer.parseInt(lmodelo.getValueAt(i, 10).toString()));
                jos_fastball_playerstat1.setHitting_k(Integer.parseInt(lmodelo.getValueAt(i, 11).toString()));
                jos_fastball_playerstat1.setHitting_hbp(Integer.parseInt(lmodelo.getValueAt(i, 12).toString()));
                jos_fastball_playerstat1.setHitting_roe(Integer.parseInt(lmodelo.getValueAt(i, 13).toString()));
                jos_fastball_playerstat1.setHitting_fc(Integer.parseInt(lmodelo.getValueAt(i, 14).toString()));
                jos_fastball_playerstat1.setHitting_sac(Integer.parseInt(lmodelo.getValueAt(i, 15).toString()));
                jos_fastball_playerstat1.setHitting_dp(Integer.parseInt(lmodelo.getValueAt(i, 16).toString()));
                jos_fastball_playerstat1.setRunning_r(Integer.parseInt(lmodelo.getValueAt(i, 17).toString()));
                jos_fastball_playerstat1.setRunning_sb(Integer.parseInt(lmodelo.getValueAt(i, 18).toString()));
                jos_fastball_playerstat1.setRunning_cs(Integer.parseInt(lmodelo.getValueAt(i, 19).toString()));
                jos_fastball_playerstat1.setRunning_lob(Integer.parseInt(lmodelo.getValueAt(i, 20).toString()));
                jos_fastball_playerstat1.setFielding_asst(Integer.parseInt(lmodelo.getValueAt(i, 21).toString()));
                jos_fastball_playerstat1.setFielding_po(Integer.parseInt(lmodelo.getValueAt(i, 22).toString()));
                jos_fastball_playerstat1.setFielding_e(Integer.parseInt(lmodelo.getValueAt(i, 23).toString()));
                jos_fastball_playerstat1.setCatching_ic(Integer.parseInt(lmodelo.getValueAt(i, 24).toString()));
                jos_fastball_playerstat1.setCatching_pb(Integer.parseInt(lmodelo.getValueAt(i, 25).toString()));
                jos_fastball_playerstat1.setCatching_sb(Integer.parseInt(lmodelo.getValueAt(i, 26).toString()));
                jos_fastball_playerstat1.setCatching_cs(Integer.parseInt(lmodelo.getValueAt(i, 27).toString()));
                jos_fastball_playerstat1.setCatching_co(Integer.parseInt(lmodelo.getValueAt(i, 28).toString()));


                /*
                 * ahora busco en la tabla pitching , localizo por el id ,
                 * obtengo los valores y guardo
                 *
                 */
                Integer id = Integer.parseInt(lmodelo.getValueAt(i, 2).toString());
                int n2 = lmodeloPitching.getRowCount();

                boolean encontrado = false;
                Integer posicion = 0;
                updateProgress("Verificando si tiene estadisticas de lanzamientos...");

                for (int j = 0; j < n2; j++) {

                    if (Integer.parseInt(lmodeloPitching.getValueAt(j, 2).toString()) == id) {

                        posicion = j;
                        jos_fastball_playerstat1.setPitching_inn(Integer.parseInt(lmodeloPitching.getValueAt(j, 4).toString()));

                        if (lmodeloPitching.getValueAt(j, 5) == null || lmodeloPitching.getValueAt(j, 5).toString().equals("") || lmodeloPitching.getValueAt(j, 5).toString().equals("--")) {
                            jos_fastball_playerstat1.setPitching_inn_p(0);
                        } else {
                            if (lmodeloPitching.getValueAt(j, 5).toString().equals("1/3")) {
                                jos_fastball_playerstat1.setPitching_inn_p(333);
                            } else {
                                if (lmodeloPitching.getValueAt(j, 5).toString().equals("2/3")) {
                                    jos_fastball_playerstat1.setPitching_inn_p(666);
                                }
                            }
                        }
                        jos_fastball_playerstat1.setPitching_count(Integer.parseInt(lmodeloPitching.getValueAt(j, 6).toString()));
                        jos_fastball_playerstat1.setPitching_bf(Integer.parseInt(lmodeloPitching.getValueAt(j, 7).toString()));
                        jos_fastball_playerstat1.setPitching_ab(Integer.parseInt(lmodeloPitching.getValueAt(j, 8).toString()));
                        jos_fastball_playerstat1.setPitching_h(Integer.parseInt(lmodeloPitching.getValueAt(j, 9).toString()));
                        jos_fastball_playerstat1.setPitching_r(Integer.parseInt(lmodeloPitching.getValueAt(j, 10).toString()));
                        jos_fastball_playerstat1.setPitching_er(Integer.parseInt(lmodeloPitching.getValueAt(j, 11).toString()));
                        jos_fastball_playerstat1.setPitching_bb(Integer.parseInt(lmodeloPitching.getValueAt(j, 12).toString()));
                        jos_fastball_playerstat1.setPitching_k(Integer.parseInt(lmodeloPitching.getValueAt(j, 13).toString()));
                        jos_fastball_playerstat1.setPitching_hr(Integer.parseInt(lmodeloPitching.getValueAt(j, 14).toString()));
                        jos_fastball_playerstat1.setPitching_wp(Integer.parseInt(lmodeloPitching.getValueAt(j, 15).toString()));
                        jos_fastball_playerstat1.setPitching_hb(Integer.parseInt(lmodeloPitching.getValueAt(j, 16).toString()));
                        if (lmodeloPitching.getValueAt(j, 17) == null || lmodeloPitching.getValueAt(j, 17).toString().equals("") || lmodeloPitching.getValueAt(j, 17).toString().equals("false")) {
                            jos_fastball_playerstat1.setPitching_w(0);
                        } else {
                            jos_fastball_playerstat1.setPitching_w(1);
                        }
                        if (lmodeloPitching.getValueAt(j, 18) == null || lmodeloPitching.getValueAt(j, 18).toString().equals("") || lmodeloPitching.getValueAt(j, 18).toString().equals("false")) {
                            jos_fastball_playerstat1.setPitching_l(0);
                        } else {
                            jos_fastball_playerstat1.setPitching_l(1);
                        }
                        if (lmodeloPitching.getValueAt(j, 19) == null || lmodeloPitching.getValueAt(j, 19).toString().equals("") || lmodeloPitching.getValueAt(j, 19).toString().equals("false")) {
                            jos_fastball_playerstat1.setPitching_s(0);
                        } else {
                            jos_fastball_playerstat1.setPitching_s(1);
                        }
                        if (lmodeloPitching.getValueAt(j, 20) == null || lmodeloPitching.getValueAt(j, 20).toString().equals("") || lmodeloPitching.getValueAt(j, 20).toString().equals("false")) {
                            jos_fastball_playerstat1.setPitching_cg(0);
                        } else {
                            jos_fastball_playerstat1.setPitching_cg(1);
                        }
                        if (lmodeloPitching.getValueAt(j, 21) == null || lmodeloPitching.getValueAt(j, 21).toString().equals("") || lmodeloPitching.getValueAt(j, 21).toString().equals("false")) {
                            jos_fastball_playerstat1.setPitching_sho(0);
                        } else {
                            jos_fastball_playerstat1.setPitching_sho(1);
                        }

                        encontrado = true;
                        break;


                    }

                }

                if (!encontrado) {
                    LimpiarPitching();


                }

                if (jos_fastball_playerstatController1.Crear(jos_fastball_playerstat1)) {

                    updateProgress("Guardando estadisticas...");
                } else {

                    sbMensajes.append("\n No se guardo la estadistica  playerid: " + jos_fastball_playerstat1.getPlayerid() + " id:" + jos_fastball_playerstat1.getId() + "error: " + jos_fastball_playerstatController1.getMensaje());
                }
            }
            /*
             * Ahora recorro la tabla pittiching porque puede que sea solo el
             * lanzador que no este registrado como jugador
             */
            mx = jos_fastball_playerstatController1.Func("max", "id").intValue();
            x = mx + 1;
            int n2 = lmodeloPitching.getRowCount();
            for (int j = 0; j < n2; j++) {

                jos_fastball_playerstat1.setId(x++);
                updateProgress("Procesando el id " + jos_fastball_playerstat1.getId());
                jos_fastball_playerstat1.setGameid(this.idpartido);
                jos_fastball_playerstat1.setHomeflag(false);
                jos_fastball_playerstat1.setEntered(false);
                String id = lmodeloPitching.getValueAt(j, 2).toString();
                jos_fastball_playerstat1.setPlayerid(Integer.parseInt(id));

                jos_fastball_playerstat1.setPitching_inn(Integer.parseInt(lmodeloPitching.getValueAt(j, 4).toString()));
                if (lmodeloPitching.getValueAt(j, 5) == null || lmodeloPitching.getValueAt(j, 5).toString().equals("") || lmodeloPitching.getValueAt(j, 5).toString().equals("--")) {
                    jos_fastball_playerstat1.setPitching_inn_p(0);
                } else {
                    if (lmodeloPitching.getValueAt(j, 5).toString().equals("1/3")) {
                        jos_fastball_playerstat1.setPitching_inn_p(333);
                    } else {
                        if (lmodeloPitching.getValueAt(j, 5).toString().equals("2/3")) {
                            jos_fastball_playerstat1.setPitching_inn_p(666);
                        }
                    }
                }
                jos_fastball_playerstat1.setPitching_count(Integer.parseInt(lmodeloPitching.getValueAt(j, 6).toString()));
                jos_fastball_playerstat1.setPitching_bf(Integer.parseInt(lmodeloPitching.getValueAt(j, 7).toString()));
                jos_fastball_playerstat1.setPitching_ab(Integer.parseInt(lmodeloPitching.getValueAt(j, 8).toString()));
                jos_fastball_playerstat1.setPitching_h(Integer.parseInt(lmodeloPitching.getValueAt(j, 9).toString()));
                jos_fastball_playerstat1.setPitching_r(Integer.parseInt(lmodeloPitching.getValueAt(j, 10).toString()));
                jos_fastball_playerstat1.setPitching_er(Integer.parseInt(lmodeloPitching.getValueAt(j, 11).toString()));
                jos_fastball_playerstat1.setPitching_bb(Integer.parseInt(lmodeloPitching.getValueAt(j, 12).toString()));
                jos_fastball_playerstat1.setPitching_k(Integer.parseInt(lmodeloPitching.getValueAt(j, 13).toString()));
                jos_fastball_playerstat1.setPitching_hr(Integer.parseInt(lmodeloPitching.getValueAt(j, 14).toString()));
                jos_fastball_playerstat1.setPitching_wp(Integer.parseInt(lmodeloPitching.getValueAt(j, 15).toString()));
                jos_fastball_playerstat1.setPitching_hb(Integer.parseInt(lmodeloPitching.getValueAt(j, 16).toString()));
                if (lmodeloPitching.getValueAt(j, 17) == null || lmodeloPitching.getValueAt(j, 17).toString().equals("") || lmodeloPitching.getValueAt(j, 17).toString().equals("false")) {
                    jos_fastball_playerstat1.setPitching_w(0);
                } else {
                    jos_fastball_playerstat1.setPitching_w(1);
                }
                if (lmodeloPitching.getValueAt(j, 18) == null || lmodeloPitching.getValueAt(j, 18).toString().equals("") || lmodeloPitching.getValueAt(j, 18).toString().equals("false")) {
                    jos_fastball_playerstat1.setPitching_l(0);
                } else {
                    jos_fastball_playerstat1.setPitching_l(1);
                }
                if (lmodeloPitching.getValueAt(j, 19) == null || lmodeloPitching.getValueAt(j, 19).toString().equals("") || lmodeloPitching.getValueAt(j, 19).toString().equals("false")) {
                    jos_fastball_playerstat1.setPitching_s(0);
                } else {
                    jos_fastball_playerstat1.setPitching_s(1);
                }
                if (lmodeloPitching.getValueAt(j, 20) == null || lmodeloPitching.getValueAt(j, 20).toString().equals("") || lmodeloPitching.getValueAt(j, 20).toString().equals("false")) {
                    jos_fastball_playerstat1.setPitching_cg(0);
                } else {
                    jos_fastball_playerstat1.setPitching_cg(1);
                }
                if (lmodeloPitching.getValueAt(j, 21) == null || lmodeloPitching.getValueAt(j, 21).toString().equals("") || lmodeloPitching.getValueAt(j, 21).toString().equals("false")) {
                    jos_fastball_playerstat1.setPitching_sho(0);
                } else {
                    jos_fastball_playerstat1.setPitching_sho(1);
                }
                /*
                 * debo buscar que no se haya agregado
                 */
                int n4 = lmodelo.getRowCount();


                boolean encontrado = false;
                for (int m = 0; m < n4; m++) {
                    if (lmodelo.getValueAt(m, 2).toString().equals(id)) {
                        encontrado = true;
                    }
                }
                if (!encontrado) {

                    LimpiarHitting();
                    //No habia registros en la otra tabla quiere decir que solo esta en la de pitcher

                    if (jos_fastball_playerstatController1.Crear(jos_fastball_playerstat1)) {
                        updateProgress("Guardar...");

                    } else {

                        sbMensajes.append("\n No se guardo la estatidistica playerid: " + jos_fastball_playerstat1.getPlayerid() + " id:" + jos_fastball_playerstat1.getId() + "error: " + jos_fastball_playerstatController1.getMensaje());
                    }
                }


            }


            return true;
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "GuardarModelo()");
        }
        return false;
    }
      
          private void LimpiarPitching() {
        try {
            jos_fastball_playerstat1.setPitching_count(0);
            jos_fastball_playerstat1.setPitching_inn(0);
            jos_fastball_playerstat1.setPitching_inn_p(0);
            jos_fastball_playerstat1.setPitching_bf(0);
            jos_fastball_playerstat1.setPitching_ab(0);
            jos_fastball_playerstat1.setPitching_h(0);
            jos_fastball_playerstat1.setPitching_r(0);
            jos_fastball_playerstat1.setPitching_er(0);
            jos_fastball_playerstat1.setPitching_bb(0);
            jos_fastball_playerstat1.setPitching_k(0);
            jos_fastball_playerstat1.setPitching_hr(0);
            jos_fastball_playerstat1.setPitching_wp(0);
            jos_fastball_playerstat1.setPitching_hb(0);
            jos_fastball_playerstat1.setPitching_w(0);
            jos_fastball_playerstat1.setPitching_l(0);
            jos_fastball_playerstat1.setPitching_s(0);
            jos_fastball_playerstat1.setPitching_cg(0);
            jos_fastball_playerstat1.setPitching_sho(0);

        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "LimpiarPitching()");
        }
    }

    private void LimpiarHitting() {
        try {
            jos_fastball_playerstat1.setPitching_count(0);
            jos_fastball_playerstat1.setHitting_h(0);
            jos_fastball_playerstat1.setBattingorder(0);
            jos_fastball_playerstat1.setHitting_pa(0);
            jos_fastball_playerstat1.setHitting_1b(0);
            jos_fastball_playerstat1.setHitting_2b(0);
            jos_fastball_playerstat1.setHitting_3b(0);
            jos_fastball_playerstat1.setHitting_hr(0);
            jos_fastball_playerstat1.setHitting_rbi(0);
            jos_fastball_playerstat1.setHitting_bb(0);
            jos_fastball_playerstat1.setHitting_k(0);
            jos_fastball_playerstat1.setHitting_hbp(0);
            jos_fastball_playerstat1.setHitting_roe(0);
            jos_fastball_playerstat1.setHitting_fc(0);
            jos_fastball_playerstat1.setHitting_dp(0);
            jos_fastball_playerstat1.setRunning_r(0);
            jos_fastball_playerstat1.setRunning_sb(0);
            jos_fastball_playerstat1.setRunning_cs(0);
            jos_fastball_playerstat1.setRunning_lob(0);
            jos_fastball_playerstat1.setFielding_asst(0);
            jos_fastball_playerstat1.setFielding_po(0);
            jos_fastball_playerstat1.setFielding_e(0);
            jos_fastball_playerstat1.setCatching_ic(0);
            jos_fastball_playerstat1.setCatching_pb(0);
            jos_fastball_playerstat1.setCatching_sb(0);
            jos_fastball_playerstat1.setCatching_cs(0);
            jos_fastball_playerstat1.setCatching_co(0);
            jos_fastball_playerstat1.setHitting_sac(0);
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "LimpiarHitting()");
        }
    }
    private boolean CargarListaJugadores() {
        try {
            updateProgress("Cargando los jugadores");
            jos_fastball_playerlist.removeAll(jos_fastball_playerlist);
            if (!jos_fastball_playerController1.Listar()) {
                Mensajeria.Mensaje("No hay registros de jugadores");
                return false;
            }
            jos_fastball_playerlist = jos_fastball_playerController1.getJos_fastball_playerlist();
            updateProgress(" ");
            return true;
        } catch (Exception ex) {
            Mensajeria.Mensaje("CargarListaJugadores()");
        }
        return false;
    }

    private void ProcesarIning() {
        try {
            updateProgress("Procesar ining....");
            if (this.idpartido <= 0) {
                Mensajeria.Mensaje("Debe seleccionar un partido primero");
                return;
            }
            LimpiarModelo(modeloResultado);
            LimpiarModelo(modeloResultado2);
            LimpiarModelo(modeloResultado3);
            if (!isNumeric(jTextFieldEpisodios.getText())) {
                Mensajeria.Mensaje("El ining debe ser un numero");
                return;
            }
            this.episodio = Integer.parseInt(jTextFieldEpisodios.getText());

            if (this.episodio <= 0) {
                Mensajeria.Mensaje("El numero de episodios no debe ser cero o negativo");
                return;
            }
            Object[] filas = new Object[14];
            filas[0] = equipolocal;
            for (int i = 1; i < 13; i++) {
                filas[i] = "";
            }

            modeloResultado.addRow(filas);
            /*
             * visitante
             */
            filas[0] = equipovisitante;

            for (int i = 1; i < 13; i++) {
                filas[i] = "";
            }
            modeloResultado.addRow(filas);


            if (this.episodio > 9) {

                filas[0] = equipolocal;
                for (int i = 1; i < 13; i++) {
                    filas[i] = "";
                }

                modeloResultado2.addRow(filas);
                /*
                 * visitante
                 */
                filas[0] = equipovisitante;

                for (int i = 1; i < 13; i++) {
                    filas[i] = "";
                }
                modeloResultado2.addRow(filas);
            }
            if (this.episodio > 18) {

                filas[0] = equipolocal;
                for (int i = 1; i < 13; i++) {
                    filas[i] = "";
                }

                modeloResultado3.addRow(filas);
                /*
                 * visitante
                 */
                filas[0] = equipovisitante;

                for (int i = 1; i < 13; i++) {
                    filas[i] = "";
                }
                modeloResultado3.addRow(filas);
            }


        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Ininig()");
        }
    }

    private void SeleccionarTodo(DefaultTableModel lmodelo, int columna) {
        try {
            for (int fila = 0; fila < lmodelo.getRowCount(); fila++) {
                lmodelo.setValueAt(true, fila, columna);

            }
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "SeleccionarTodo()");
        }
    }

    private void DeSeleccionarTodo(DefaultTableModel lmodelo, int columna) {
        try {
            for (int fila = 0; fila < lmodelo.getRowCount(); fila++) {
                lmodelo.setValueAt(false, fila, columna);

            }
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "SeleccionarTodo()");
        }
    }


    private void LimpiarTodosLosDatos() {
        try {
            idtemporada = 0;
            idequipolocal = 0;
            idequipovisitante = 0;
            idpartido = 0;
            equipolocal = "";
            equipovisitante = "";
            episodio = 0;
            estatus = 0;
            LimpiarModelo(modeloResultado);
            LimpiarModelo(modeloResultado2);
            LimpiarModelo(modeloResultado3);
            LimpiarModelo(modeloPitchingLocal);
            LimpiarModelo(modeloPitchingVisitante);
            LimpiarModelo(modeloHittingLocal);
            LimpiarModelo(modeloHittingVisitante);
            jTextFieldEpisodios.setText("");
            jTextFieldEpisodiosDialogo.setText("");
            jTextFieldEquipoJugadores.setText("");
            jTextFieldEstadio.setText("");
            jTextFieldEstatusOld.setText("");
            jTextFieldFecha.setText("");
            jTextFieldIdPartido.setText("");
            jTextFieldLocal.setText("");
            jTextFieldNombreEquipoLocal1.setText("");
            jTextFieldNombreEquipoLocal2.setText("");
            jTextFieldNombreEquipoVisitante1.setText("");
            jTextFieldNombreEquipoVisitante2.setText("");
            jTextFieldTipo.setText("");
            jTextFieldVisitante.setText("");

            CargarAgenda();
            CargarEstatus();

        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "Limpiar todos los datos()");
        }
    }

    private boolean VerificarMacador() {
        try {
            updateProgress("Verificando el marcador...");
            this.episodio = Integer.parseInt(jTextFieldEpisodios.getText());
            if (this.episodio < 0) {
                Mensajeria.Mensaje("El  numero de episodio no es correcto");
                return false;
            }
            Integer totalCarrerasHome = 0;
            Integer totalCarrerasVisitante = 0;
            Integer carrera;
            for (int i = 1; i <= 9; i++) {

                carrera = Integer.parseInt(jTableResultado.getValueAt(0, i).toString());
                if (carrera < 0) {
                    Mensajeria.Mensaje("El numero de carreras del equipo " + this.equipolocal + " en el episodio: " + i + " No debe ser negativo");
                    return false;

                }
                totalCarrerasHome += carrera;

                carrera = Integer.parseInt(jTableResultado.getValueAt(1, i).toString());
                if (carrera < 0) {
                    Mensajeria.Mensaje("El numero de carreras del equipo " + this.equipovisitante + " en el episodio: " + i + " No debe ser negativo");
                    return false;

                }
                totalCarrerasVisitante += carrera;

            }
            if (this.episodio > 9) {
                for (int i = 1; i <= 9; i++) {

                    carrera = Integer.parseInt(jTableResultado2.getValueAt(0, i).toString());
                    if (carrera < 0) {
                        Mensajeria.Mensaje("El numero de carreras del equipo " + this.equipolocal + " en el episodio: " + i + " No debe ser negativo");
                        return false;

                    }
                    totalCarrerasHome += carrera;

                    carrera = Integer.parseInt(jTableResultado2.getValueAt(1, i).toString());
                    if (carrera < 0) {
                        Mensajeria.Mensaje("El numero de carreras del equipo " + this.equipovisitante + " en el episodio: " + i + " No debe ser negativo");
                        return false;

                    }
                    totalCarrerasVisitante += carrera;

                }
            }
            if (this.episodio > 18) {
                for (int i = 1; i <= 9; i++) {
                    carrera = Integer.parseInt(jTableResultado3.getValueAt(0, i).toString());
                    if (carrera < 0) {
                        Mensajeria.Mensaje("El numero de carreras del equipo " + this.equipolocal + " en el episodio: " + i + " No debe ser negativo");
                        return false;

                    }
                    totalCarrerasHome += carrera;

                    carrera = Integer.parseInt(jTableResultado3.getValueAt(1, i).toString());
                    if (carrera < 0) {
                        Mensajeria.Mensaje("El numero de carreras del equipo " + this.equipovisitante + " en el episodio: " + i + " No debe ser negativo");
                        return false;

                    }
                    totalCarrerasVisitante += carrera;
                }
            }
            if (totalCarrerasHome != Integer.parseInt(modeloResultado.getValueAt(0, 10).toString())) {

                Mensajeria.Mensaje("El numero de carreras por episodio del equipo :" + this.equipolocal + " no coincide con el total ");
                return false;
            }
            if (totalCarrerasVisitante != Integer.parseInt(modeloResultado.getValueAt(1, 10).toString())) {
                Mensajeria.Mensaje("El numero de carreras por episodio del equipo :" + this.equipovisitante + " no coincide con el total ");
                return false;
            }
            if (totalCarrerasHome == 0 && totalCarrerasVisitante == 0) {

                if (Mensajeria.PreguntaSiNo("No se han registrado las carreras del juego\nEl juego quedo 0 a 0 esta seguro de esto?", "Empate a cero").equals("si")) {
                    return true;

                } else {
                    return false;
                }
            }
            return true;
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "VerificarMarcador()");
        }
        return false;
    }

    private boolean GuardarIning() {
        try {
            updateProgress("Iniciando guardar ining...");
            /*
             * Elimino los datos anteriores de ese juego
             */
            jos_fastball_linescore1.setGameid(idpartido);
            String sql = "gameid='" + this.idpartido + "'";

            if (jos_fastball_linescoreController1.Eliminar(sql)) {
            } else {
                sbMensajes.append("\nNo se pudo eliminar los registros anteriores por episodio para guardar los nuevos " + jos_fastball_linescoreController1.getMensaje());
            }
            this.episodio = Integer.parseInt(jTextFieldEpisodios.getText());
            if (this.episodio < 0) {
                Mensajeria.Mensaje("El  numero de episodio no es correcto");
                return false;
            }

            for (int i = 1; i <= 9; i++) {
                updateProgress("Guardando ining ..." + i);
                jos_fastball_linescore1.setGameid(idpartido);
                jos_fastball_linescore1.setInning(i);
                jos_fastball_linescore1.setRunshome(Integer.parseInt(jTableResultado.getValueAt(0, i).toString()));
                jos_fastball_linescore1.setRunsaway(Integer.parseInt(jTableResultado.getValueAt(1, i).toString()));
                if (jos_fastball_linescoreController1.Crear(jos_fastball_linescore1)) {
                } else {
                    sbMensajes.append("\nNo se pudo guardarn el episodio " + i + " del primer marcador ");
                }
            }
            if (this.episodio > 9) {
                for (int i = 1; i <= 9; i++) {
                    updateProgress("Guardando ining ..." + i);
                    jos_fastball_linescore1.setGameid(idpartido);
                    jos_fastball_linescore1.setInning(i);
                    jos_fastball_linescore1.setRunshome(Integer.parseInt(jTableResultado2.getValueAt(0, i).toString()));
                    jos_fastball_linescore1.setRunsaway(Integer.parseInt(jTableResultado2.getValueAt(1, i).toString()));
                    if (jos_fastball_linescoreController1.Crear(jos_fastball_linescore1)) {
                    } else {
                        sbMensajes.append("\nNo se pudo guardarn el episodio " + i + " del segundo marcador");
                    }
                }
            }
            if (this.episodio > 18) {
                for (int i = 1; i <= 9; i++) {
                    updateProgress("Guardando ining ..." + i);
                    jos_fastball_linescore1.setGameid(idpartido);
                    jos_fastball_linescore1.setInning(i);
                    jos_fastball_linescore1.setRunshome(Integer.parseInt(jTableResultado3.getValueAt(0, i).toString()));
                    jos_fastball_linescore1.setRunsaway(Integer.parseInt(jTableResultado3.getValueAt(1, i).toString()));
                    if (jos_fastball_linescoreController1.Crear(jos_fastball_linescore1)) {
                    } else {
                        sbMensajes.append("\nNo se pudo guardarn el episodio " + i + " del tercer marcador");
                    }
                }
            }
            return true;
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "GuadarIning()");
            sbMensajes.append("\nGuardarIning() " + ex.getLocalizedMessage());
        }
        return false;
    }

    private void CargarTemporada() {
        try {
            updateProgress("Cargando temporadas....");
            jXComboBoxTemporada.removeAllItems();
            jos_fastball_season1.setId(SesionLocal.getIdtemporada());
            if (jos_fastball_seasonContoller1.findById(jos_fastball_season1)) {
                for (Jos_fastball_season s : jos_fastball_seasonContoller1.getJos_fastball_seasonlist()) {
                    updateProgress("Cargando temporadas " + s.getName());
                    jXComboBoxTemporada.addItem(s.getName());
                }
                //jButtonCargar.setEnabled(true);
            } else {
                Mensajeria.Mensaje("No hay ninguna temporada activa");
                //  jButtonCargar.setEnabled(false);
            }
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "CargarTemporada()");
        }
    }

    private boolean ActualizarCalendario() {
        try {
            updateProgress("Actualizando calendario...");
            int a = jXComboBoxPartido.getSelectedIndex();
            if (a != -1) {
                jos_fastball_schedule1 = jos_fastball_scheduleController1.getJos_fastball_schedulelist().get(a);
                jos_fastball_schedule1.setStatus(estatus);
                jos_fastball_schedule1.setRunshome(Integer.parseInt(jTableResultado.getValueAt(0, 10).toString()));
                jos_fastball_schedule1.setRunsaway(Integer.parseInt(jTableResultado.getValueAt(1, 10).toString()));
                jos_fastball_schedule1.setHitshome(Integer.parseInt(jTableResultado.getValueAt(0, 11).toString()));
                jos_fastball_schedule1.setHitsaway(Integer.parseInt(jTableResultado.getValueAt(1, 11).toString()));
                jos_fastball_schedule1.setErrorshome(Integer.parseInt(jTableResultado.getValueAt(0, 12).toString()));
                jos_fastball_schedule1.setErrorsaway(Integer.parseInt(jTableResultado.getValueAt(1, 12).toString()));
                if (jos_fastball_scheduleController1.Editar(jos_fastball_schedule1)) {
                    updateProgress("Se actualizo el calendario");
                } else {
                    sbMensajes.append("\nNo se actualizo el calendario" + jos_fastball_scheduleController1.getMensaje());
                    return false;
                }
            }
            return true;
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "ActualizarCalendario()");
            sbMensajes.append("\nActualizarCalendario() " + ex.getLocalizedMessage());
        }
        return false;
    }

    private void CargarEstatus() {
        try {
            updateProgress("Buscando estatus...");
            jXComboBoxEstatus.removeAllItems();

            if (jos_fastball_gamestatusController1.Listar()) {
                for (Jos_fastball_gamestatus s : jos_fastball_gamestatusController1.getJos_fastball_gamestatuslist()) {
                    updateProgress("cargando el estatus " + s.getDescription());
                    jXComboBoxEstatus.addItem(s.getDescription());
                }
            }
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "CargarTemporada()");
        }
    }

    private void CargarAgenda() {
        try {
            updateProgress("Cargando la agenda...");
            jXComboBoxPartido.removeAllItems();
            jos_fastball_schedule1.setSeason(this.idtemporada);
            boolean existe = false;
            String sql = "season ='" + this.idtemporada + "' and status>'1'";

            if (jos_fastball_scheduleController1.Query(sql)) {
                for (Jos_fastball_schedule j : jos_fastball_scheduleController1.getJos_fastball_schedulelist()) {
                    updateProgress("cargando combo agenda...");
                    String lequipolocal = ObtenerNombreEquipo(j.getHometeam());
                    String lequipovisitante = ObtenerNombreEquipo(j.getVisitingteam());
                     jXComboBoxPartido.addItem(j.getId() - SesionLocal.getDecrementarparamostrar() + " | " +j.getGamedatetime().toString() + " | " + lequipolocal + "  vs.  " + lequipovisitante);
                }
                jButtonCargar.setEnabled(true);
            } else {
//                Mensajeria.Mensaje("No existen juegos en esta temporada que esten pendientes...");
                jButtonCargar.setEnabled(false);
            }
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "cargarAgenda()");
        }
    }

    private String ObtenerNombreEquipo(Integer lid) {
        try {
          
            updateProgress("Obteniendo el nombre del equipo " + lid);
            String name = "";
//            jos_fastball_team1.setId(lid);
//            Jos_fastball_team jos_fastball_team = jos_fastball_teamController1.findByPrimaryKey(jos_fastball_team1);
//            if (jos_fastball_team == null) {
//            } else {
//                name = jos_fastball_team.getName();
//
//            }
            for (Jos_fastball_team j : jos_fastball_teamlist) {
                if (lid.equals(j.getId())) {
             
                    return j.getName();
                }
            }
    
            return name;
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "ObtenerNombreEquipo()");
        }
        return "";
    }

    private void LimpiarModelo(DefaultTableModel lmodelo) {
        try {
            if (lmodelo != null) {
                while (lmodelo.getRowCount() > 0) {
                    lmodelo.removeRow(0);
                }
            }
        } catch (Exception ex) {
            Mensajeria.MensajeError(ex, "LimpiarModelo()");
        }
    }

    private static boolean isNumeric(String cadena) {
        try {
            Integer.parseInt(cadena);
            return true;
        } catch (NumberFormatException nfe) {
            return false;
        }
    }

    private void updateProgress(final String texto) {
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                // Here, we can safely update the GUI
                // because we'll be called from the
                // event dispatch thread
//                 statusLabel.setText( texto+ " : " + queryNo);
                statusLabel.setText(texto);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButtonAgregar;
    private javax.swing.JButton jButtonAgregarJugadorPittchingLocal;
    private javax.swing.JButton jButtonAgregarJugadores;
    private javax.swing.JButton jButtonAgregarJugadoresHittingVisitante;
    private javax.swing.JButton jButtonAgregarPittchingVisitante;
    private javax.swing.JButton jButtonCargar;
    private javax.swing.JButton jButtonCerrar;
    private javax.swing.JButton jButtonCerrar1;
    private javax.swing.JButton jButtonEliminar;
    private javax.swing.JButton jButtonEliminar2;
    private javax.swing.JButton jButtonEliminar3;
    private javax.swing.JButton jButtonEliminar4;
    private javax.swing.JButton jButtonEstablecerEpisodios;
    private javax.swing.JButton jButtonGuardar;
    private javax.swing.JButton jButtonSeleccionarTodo;
    private javax.swing.JDialog jDialogAgregar;
    private javax.swing.JDialog jDialogIning;
    private javax.swing.JDialog jDialogMensajesResultados;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelFotoLocal1;
    private javax.swing.JLabel jLabelFotoVisitante1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JPanel jPanelResultado;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTableHittingLocal;
    private javax.swing.JTable jTableHittingVisitante;
    private javax.swing.JTable jTableJugadores;
    private javax.swing.JTable jTablePitchingLocal;
    private javax.swing.JTable jTablePitchingVisitante;
    private javax.swing.JTable jTableResultado;
    private javax.swing.JTable jTableResultado2;
    private javax.swing.JTable jTableResultado3;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextFieldEpisodios;
    private javax.swing.JTextField jTextFieldEpisodiosDialogo;
    private javax.swing.JTextField jTextFieldEquipoJugadores;
    private javax.swing.JTextField jTextFieldEstadio;
    private javax.swing.JTextField jTextFieldEstatusOld;
    private javax.swing.JTextField jTextFieldFecha;
    private javax.swing.JTextField jTextFieldIdPartido;
    private javax.swing.JTextField jTextFieldLocal;
    private javax.swing.JTextField jTextFieldNombreEquipoLocal1;
    private javax.swing.JTextField jTextFieldNombreEquipoLocal2;
    private javax.swing.JTextField jTextFieldNombreEquipoVisitante1;
    private javax.swing.JTextField jTextFieldNombreEquipoVisitante2;
    private javax.swing.JTextField jTextFieldTipo;
    private javax.swing.JTextField jTextFieldVisitante;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JToolBar jToolBar2;
    private javax.swing.JToolBar jToolBar3;
    private javax.swing.JToolBar jToolBar4;
    private org.jdesktop.swingx.JXComboBox jXComboBoxEstatus;
    private org.jdesktop.swingx.JXComboBox jXComboBoxPartido;
    private org.jdesktop.swingx.JXComboBox jXComboBoxTemporada;
    private org.jdesktop.swingx.JXStatusBar jXStatusBar1;
    // End of variables declaration//GEN-END:variables
}
